import { T as User, c as DeviceType, n as AuthAdapter, o as AuthenticatorTransport, s as Credential } from "./types-DZ0waGOT.mjs"; //#region src/passkey/types.d.ts interface RegistrationOptions { challenge: string; rp: { name: string; id: string; }; user: { id: string; name: string; displayName: string; }; pubKeyCredParams: Array<{ type: "public-key"; alg: number; }>; timeout?: number; attestation?: "none" | "indirect" | "direct"; authenticatorSelection?: { authenticatorAttachment?: "platform" | "cross-platform"; residentKey?: "discouraged" | "preferred" | "required"; requireResidentKey?: boolean; userVerification?: "discouraged" | "preferred" | "required"; }; excludeCredentials?: Array<{ type: "public-key"; id: string; transports?: AuthenticatorTransport[]; }>; } interface RegistrationResponse { id: string; rawId: string; type: "public-key"; response: { clientDataJSON: string; attestationObject: string; transports?: AuthenticatorTransport[]; }; authenticatorAttachment?: "platform" | "cross-platform"; } interface VerifiedRegistration { credentialId: string; publicKey: Uint8Array; algorithm: number; counter: number; deviceType: DeviceType; backedUp: boolean; transports: AuthenticatorTransport[]; } interface AuthenticationOptions { challenge: string; rpId: string; timeout?: number; userVerification?: "discouraged" | "preferred" | "required"; allowCredentials?: Array<{ type: "public-key"; id: string; transports?: AuthenticatorTransport[]; }>; } interface AuthenticationResponse { id: string; rawId: string; type: "public-key"; response: { clientDataJSON: string; authenticatorData: string; signature: string; userHandle?: string; }; authenticatorAttachment?: "platform" | "cross-platform"; } interface VerifiedAuthentication { credentialId: string; newCounter: number; } interface ChallengeStore { set(challenge: string, data: ChallengeData): Promise; get(challenge: string): Promise; delete(challenge: string): Promise; } interface ChallengeData { type: "registration" | "authentication"; userId?: string; expiresAt: number; } interface PasskeyConfig { rpName: string; rpId: string; /** * Accepted client-data origins. The first entry is the canonical/preferred * origin; verification accepts any entry. Multiple entries support * deployments where the same RP is reachable under several hostnames * sharing `rpId` (e.g. apex + preview subdomain). */ origins: string[]; } //#endregion //#region src/passkey/register.d.ts /** * Generate registration options for creating a new passkey */ declare function generateRegistrationOptions(config: PasskeyConfig, user: Pick, existingCredentials: Credential[], challengeStore: ChallengeStore): Promise; /** * Verify a registration response and extract credential data */ declare function verifyRegistrationResponse(config: PasskeyConfig, response: RegistrationResponse, challengeStore: ChallengeStore): Promise; /** * Register a new passkey for a user */ declare function registerPasskey(adapter: AuthAdapter, userId: string, verified: VerifiedRegistration, name?: string): Promise; //#endregion //#region src/passkey/authenticate.d.ts type PasskeyAuthenticationErrorCode = "credential_not_found" | "invalid_response" | "challenge_not_found" | "invalid_challenge_type" | "challenge_expired" | "invalid_client_data_type" | "invalid_origin" | "invalid_rp_id_hash" | "user_presence_not_verified" | "invalid_signature_counter" | "invalid_signature" | "unsupported_algorithm" | "user_not_found"; declare class PasskeyAuthenticationError extends Error { code: PasskeyAuthenticationErrorCode; constructor(code: PasskeyAuthenticationErrorCode, message: string); } /** * Generate authentication options for signing in with a passkey */ declare function generateAuthenticationOptions(config: PasskeyConfig, credentials: Credential[], challengeStore: ChallengeStore): Promise; /** * Verify an authentication response */ declare function verifyAuthenticationResponse(config: PasskeyConfig, response: AuthenticationResponse, credential: Credential, challengeStore: ChallengeStore): Promise; /** * Authenticate a user with a passkey */ declare function authenticateWithPasskey(config: PasskeyConfig, adapter: AuthAdapter, response: AuthenticationResponse, challengeStore: ChallengeStore): Promise; //#endregion export { VerifiedRegistration as _, verifyAuthenticationResponse as a, verifyRegistrationResponse as c, ChallengeData as d, ChallengeStore as f, VerifiedAuthentication as g, RegistrationResponse as h, generateAuthenticationOptions as i, AuthenticationOptions as l, RegistrationOptions as m, PasskeyAuthenticationErrorCode as n, generateRegistrationOptions as o, PasskeyConfig as p, authenticateWithPasskey as r, registerPasskey as s, PasskeyAuthenticationError as t, AuthenticationResponse as u }; //# sourceMappingURL=authenticate-Da9jec28.d.mts.map