Auth Types
Provider-agnostic interfaces for authentication and key derivation
Installation
pnpm add @learncard/typesInterfaces
AuthProvider
interface AuthProvider {
/** Get the provider type identifier (e.g., 'firebase') */
getProviderType(): AuthProviderType;
/** Get the currently authenticated user, or null */
getCurrentUser(): Promise<AuthUser | null>;
/** Get a fresh ID token for the current user */
getIdToken(): Promise<string>;
/** Sign out the current user */
signOut(): Promise<void>;
/** Subscribe to auth state changes. Returns an unsubscribe function. */
onAuthStateChanged(callback: (user: AuthUser | null) => void): () => void;
/** Re-authenticate with a custom token (e.g., after contact method upgrade) */
reauthenticateWithToken?(token: string): Promise<void>;
}AuthUser
KeyDerivationStrategy
ServerKeyStatus
RecoveryMethodInfo
SignInAdapter
AuthSessionError
Usage
Last updated
Was this helpful?