import { CreateRequest, UpdateRequest } from './auth-request-handler'; import { Credential, ServiceAccount } from './credential'; import { CustomTokens, ParsedCookies } from './custom-token/index.js'; import { AuthError } from './error'; import { DecodedIdToken, TokenSet, VerifyOptions } from './types.js'; import { UserRecord } from './user-record.js'; export * from './error.js'; export * from './types.js'; interface CustomTokenToIdAndRefreshTokensOptions { tenantId?: string; appCheckToken?: string; referer?: string; } export declare function customTokenToIdAndRefreshTokens(customToken: string, firebaseApiKey: string, options: CustomTokenToIdAndRefreshTokensOptions): Promise; export declare function createAnonymousAccount(firebaseApiKey: string, options?: CreateAnonymousRequest): Promise; export interface TokenRefreshOptions { apiKey: string; referer?: string; } export declare function isUserNotFoundError(error: unknown): error is AuthError; export declare function isInvalidCredentialError(error: unknown): error is AuthError; export declare function handleExpiredToken(verifyIdToken: () => Promise, onExpired: (e: AuthError) => Promise, onError: (e: unknown) => Promise, shouldExpireOnNoMatchingKidError: boolean): Promise; export interface IdAndRefreshTokens { idToken: string; refreshToken: string; } export interface CreateAnonymousRequest { tenantId?: string; appCheckToken?: string; referer?: string; } export interface AnonymousTokens { idToken: string; refreshToken: string; localId: string; } export interface UsersList { users: UserRecord[]; nextPageToken?: string; } export interface GetCustomIdAndRefreshTokensOptions { appCheckToken?: string; referer?: string; dynamicCustomClaimsKeys?: string[]; } interface AuthOptions { credential: Credential; apiKey: string; tenantId?: string; serviceAccountId?: string; enableCustomToken?: boolean; } export type Auth = ReturnType; declare function getAuth(options: AuthOptions): { verifyAndRefreshExpiredIdToken: (parsedCookies: ParsedCookies, verifyOptions?: VerifyOptions & { onTokenRefresh?: (tokens: TokenSet) => Promise; }) => Promise; verifyIdToken: (idToken: string, options?: VerifyOptions) => Promise; createCustomToken: (uid: string, developerClaims?: { [key: string]: unknown; }) => Promise; getCustomIdAndRefreshTokens: (idToken: string, customTokensOptions?: GetCustomIdAndRefreshTokensOptions) => Promise; handleTokenRefresh: (refreshToken: string, tokenRefreshOptions?: { referer?: string; enableCustomToken?: boolean; }) => Promise; deleteUser: (uid: string) => Promise; setCustomUserClaims: (uid: string, customUserClaims: object | null) => Promise; getUser: (uid: string) => Promise; getUserByEmail: (email: string) => Promise; updateUser: (uid: string, properties: UpdateRequest) => Promise; createUser: (properties: CreateRequest) => Promise; createAnonymousUser: (firebaseApiKey: string) => Promise; listUsers: (nextPageToken?: string, maxResults?: number) => Promise; createSessionCookie: (idToken: string, expiresInMs: number) => Promise; }; export interface FirebaseAuthOptions { serviceAccount?: ServiceAccount; apiKey: string; tenantId?: string; serviceAccountId?: string; enableCustomToken?: boolean; } export declare function getFirebaseAuth(options: FirebaseAuthOptions): Auth; export declare function getFirebaseAuth(serviceAccount: ServiceAccount, apiKey: string, tenantId?: string): Auth;