UNPKG

expo-passkey

Version:

Passkey authentication for Expo apps with Better Auth integration

51 lines 2.12 kB
/** * @file Web-specific utilities for WebAuthn. Runs only in web environments. * @module expo-passkey/client/utils/web */ import type { AuthenticatorSelectionCriteria, AttestationConveyancePreference, UserVerificationRequirement } from "../../types"; import type { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON } from "@simplewebauthn/types"; import * as webAuthnBrowser from "@simplewebauthn/browser"; /** * Get WebAuthn browser module (now statically imported) */ export declare function getWebAuthnBrowser(): typeof webAuthnBrowser; /** * Create registration options for web (SimpleWebAuthn JSON format) */ export declare function createWebRegistrationOptions(challenge: string, userId: string, userName: string, displayName: string, rpId: string, rpName: string, options?: { timeout?: number; attestation?: AttestationConveyancePreference; authenticatorSelection?: AuthenticatorSelectionCriteria; excludeCredentials?: Array<{ id: string; type: "public-key"; }>; }): PublicKeyCredentialCreationOptionsJSON; /** * Create authentication options for web (SimpleWebAuthn JSON format) */ export declare function createWebAuthenticationOptions(challenge: string, rpId: string, options?: { timeout?: number; userVerification?: UserVerificationRequirement; allowCredentials?: Array<{ id: string; type: "public-key"; }>; }): PublicKeyCredentialRequestOptionsJSON; /** * Check if WebAuthn is supported in the current browser */ export declare function isWebAuthnSupportedInBrowser(): boolean; /** * Check if platform authenticator is available in the browser */ export declare function isPlatformAuthenticatorAvailable(): Promise<boolean>; /** * Browser-specific error messages */ export declare const WEB_ERROR_MESSAGES: { readonly NOT_SECURE_CONTEXT: "WebAuthn requires a secure context (HTTPS)"; readonly BROWSER_NOT_SUPPORTED: "Your browser does not support WebAuthn"; readonly PLATFORM_AUTHENTICATOR_NOT_AVAILABLE: "No platform authenticator available"; }; //# sourceMappingURL=web.d.ts.map