UNPKG

react-passkey-pro

Version:

🔐 The most comprehensive React library for WebAuthn passkey authentication. Drop-in components, TypeScript support, and zero dependencies. Secure, fast, and developer-friendly.

69 lines 2.18 kB
export interface PasskeyUser { id: string; name: string; displayName: string; } export interface PasskeyP256PublicKey { kty: number; alg: number; crv: number; x: string; y: string; extracted: boolean; } export interface PasskeyCredential { id: string; publicKey: PasskeyP256PublicKey; userId: string; createdAt: Date; lastUsed?: Date; deviceName?: string; transports?: AuthenticatorTransport[]; } export interface PasskeyRegistrationOptions { user: PasskeyUser; challenge?: BufferSource; excludeCredentials?: string[]; authenticatorSelection?: AuthenticatorSelectionCriteria; attestation?: AttestationConveyancePreference; timeout?: number; onSuccess?: (credential: PasskeyCredential) => void; onError?: (error: Error) => void; } export interface PasskeyAuthenticationResponse { credentialId: string; challenge: string; signature: string; clientDataJSON: string; authenticatorData: string; userHandle?: string; } export interface PasskeyAuthenticationOptions { challenge?: BufferSource; allowCredentials?: string[]; userVerification?: UserVerificationRequirement; timeout?: number; onSuccess?: (response: PasskeyAuthenticationResponse) => void; onError?: (error: Error) => void; } export interface PasskeyContextValue { isSupported: boolean; isRegistering: boolean; isAuthenticating: boolean; credentials: PasskeyCredential[]; register: (options: PasskeyRegistrationOptions) => Promise<PasskeyCredential>; authenticate: (options?: PasskeyAuthenticationOptions) => Promise<PasskeyAuthenticationResponse>; deleteCredential: (credentialId: string) => Promise<void>; clearCredentials: () => void; } export interface PasskeyProviderProps { children: React.ReactNode; storageKey?: string; } export type PasskeyStorageAdapter = { getCredentials: () => Promise<PasskeyCredential[]>; saveCredential: (credential: PasskeyCredential) => Promise<void>; deleteCredential: (credentialId: string) => Promise<void>; clearCredentials: () => Promise<void>; }; //# sourceMappingURL=index.d.ts.map