UNPKG

capacitor-biometric-authentication

Version:

Framework-agnostic biometric authentication library. Works with React, Vue, Angular, or vanilla JS. No providers required!

37 lines (36 loc) 1.55 kB
import { BiometricAuthAdapter, BiometricAuthConfiguration, BiometricAuthOptions, BiometricAuthResult, BiometricAuthState, BiometryType } from './types'; export declare class BiometricAuthCore { private static instance; private config; private sessionTimeoutId; private adapters; private currentAdapter; private state; private platformDetector; private subscribers; private initPromise; private constructor(); /** * Ensures the adapter is initialized before use. * This prevents race conditions where methods are called before * the async initialization completes. */ private ensureInitialized; static getInstance(): BiometricAuthCore; private initialize; private loadAdapter; configure(config: Partial<BiometricAuthConfiguration>): void; registerAdapter(name: string, adapter: BiometricAuthAdapter): void; isAvailable(): Promise<boolean>; getSupportedBiometrics(): Promise<BiometryType[]>; authenticate(options?: BiometricAuthOptions): Promise<BiometricAuthResult>; deleteCredentials(): Promise<void>; hasCredentials(): Promise<boolean>; logout(): void; getState(): BiometricAuthState; isAuthenticated(): boolean; subscribe(callback: (state: BiometricAuthState) => void): () => void; private updateState; requireAuthentication(callback: () => void | Promise<void>, options?: BiometricAuthOptions): Promise<void>; withAuthentication<T>(callback: () => T | Promise<T>, options?: BiometricAuthOptions): Promise<T>; }