UNPKG

@pedwise/next-firebase-auth-edge

Version:

Next.js 13 Firebase Authentication for Edge and server runtimes. Dedicated for Next 13 server components. Compatible with Next.js middleware.

55 lines (54 loc) 2.38 kB
import { ServiceAccount } from "./credential"; export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD"; export type ApiCallbackFunction = (data: object) => void; export declare class ApiSettings { private endpoint; private httpMethod; private requestValidator; private responseValidator; constructor(endpoint: string, httpMethod?: HttpMethod); getEndpoint(): string; getHttpMethod(): HttpMethod; setRequestValidator(requestValidator: ApiCallbackFunction | null): ApiSettings; getRequestValidator(): ApiCallbackFunction; setResponseValidator(responseValidator: ApiCallbackFunction | null): ApiSettings; getResponseValidator(): ApiCallbackFunction; } export declare function getSdkVersion(): string; declare class AuthResourceUrlBuilder { protected version: string; private projectId; protected urlFormat: string; constructor(version: string, projectId: string); getUrl(api?: string, params?: object): Promise<string>; } export declare const FIREBASE_AUTH_GET_ACCOUNT_INFO: ApiSettings; export declare const FIREBASE_AUTH_DELETE_ACCOUNT: ApiSettings; export interface AuthFactorInfo { mfaEnrollmentId?: string; displayName?: string; phoneInfo?: string; enrolledAt?: string; [key: string]: any; } export declare const RESERVED_CLAIMS: string[]; export declare const FIREBASE_AUTH_SET_ACCOUNT_INFO: ApiSettings; export declare abstract class AbstractAuthRequestHandler { private authUrlBuilder; private getToken; private static getErrorCode; constructor(serviceAccount: ServiceAccount); getAccountInfoByUid(uid: string): Promise<object>; deleteAccount(uid: string): Promise<object>; setCustomUserClaims(uid: string, customUserClaims: object | null): Promise<string>; protected invokeRequestHandler(urlBuilder: AuthResourceUrlBuilder, apiSettings: ApiSettings, requestData: object | undefined, additionalResourceParams?: object): Promise<object>; protected abstract newAuthUrlBuilder(): AuthResourceUrlBuilder; private getAuthUrlBuilder; } export declare class AuthRequestHandler extends AbstractAuthRequestHandler { private serviceAccount; protected readonly authResourceUrlBuilder: AuthResourceUrlBuilder; constructor(serviceAccount: ServiceAccount); protected newAuthUrlBuilder(): AuthResourceUrlBuilder; } export {};