capacitor-biometric-authentication
Version:
Framework-agnostic biometric authentication library. Works with React, Vue, Angular, or vanilla JS. No providers required!
69 lines (68 loc) • 1.82 kB
TypeScript
export interface SessionData {
token: string;
expiresAt: number;
metadata?: Record<string, unknown>;
}
export declare class SessionManager {
private static readonly SESSION_KEY;
private static readonly ENCRYPTION_KEY;
/**
* Generate a cryptographically secure random token
*/
static generateSecureToken(): string;
/**
* Store session data securely
*/
static storeSession(session: SessionData): Promise<void>;
/**
* Retrieve session data
*/
static getSession(): Promise<SessionData | null>;
/**
* Clear session data
*/
static clearSession(): Promise<void>;
/**
* Check if session is valid
*/
static isSessionValid(): Promise<boolean>;
/**
* Extend session expiration
*/
static extendSession(durationMs: number): Promise<boolean>;
/**
* Simple encryption using Web Crypto API (for demonstration)
* In production, use a proper encryption library or service
*/
private static encrypt;
/**
* Simple decryption using Web Crypto API
*/
private static decrypt;
}
/**
* Credential storage utilities
*/
export declare class CredentialManager {
private static readonly CREDENTIAL_PREFIX;
/**
* Store credential securely
*/
static storeCredential(credentialId: string, credentialData: unknown, encrypt?: boolean): Promise<void>;
/**
* Retrieve credential
*/
static getCredential(credentialId: string, decrypt?: boolean): Promise<unknown | null>;
/**
* Delete credential
*/
static deleteCredential(credentialId: string): void;
/**
* List all credential IDs
*/
static listCredentialIds(): string[];
/**
* Clear all credentials
*/
static clearAllCredentials(): void;
}