import type { RequestHandler } from '@sveltejs/kit'; import type { AuthDeps } from '../deps.js'; import { type WebAuthnConfig } from './webauthn.js'; /** * The full passkey route group: the four WebAuthn ceremony endpoints plus the * self-service list/rename/delete set behind ``. One bundled factory * (the package's multi-route convention, like `createInvitationHandlers` / * `createNotificationsHandlers`) over the canonical `AuthDeps` bundle; the * WebAuthn ceremony config rides as the second argument. Mount the groups on * the paths the client components call (default base `/api/auth/passkey`): * * ```ts * const passkey = createPasskeyHandlers(deps, webauthnConfig); * // …/registration-options/+server.ts → export const POST = passkey.registrationOptions.POST; * // …/registration-verify/+server.ts → export const POST = passkey.registrationVerify.POST; * // …/authentication-options/+server.ts → export const POST = passkey.authenticationOptions.POST; * // …/authentication-verify/+server.ts → export const POST = passkey.authenticationVerify.POST; * // …/list/+server.ts → export const GET = passkey.list.GET; * // …/[credentialId]/+server.ts → export const DELETE = passkey.item.DELETE; * // export const PATCH = passkey.item.PATCH; * ``` * * (The static sibling routes take precedence over the `[credentialId]` param * route, so all six share the base path.) Requires `deps.repos.passkey` — * throws at wiring time when it is missing (fail-loud, not a latent 500). * * Every ceremony failure answers with the bare `passkey_verification_failed` * code and no `message` override, so the browser gets one localized sentence * (`auth.errors.passkeyVerificationFailed`) whatever went wrong: none of the * causes is actionable by the user, and one of them — the sign-counter * regression — is a clone warning that must not be readable in a page. What * separates them stays server-side: `config.hooks.onLoginFailed(email, reason)` * receives a distinct reason per outcome, and `deps.logger` receives the three * details a reason string cannot carry. */ export declare function createPasskeyHandlers(deps: AuthDeps, webauthn: WebAuthnConfig): { registrationOptions: { POST: RequestHandler; }; registrationVerify: { POST: RequestHandler; }; authenticationOptions: { POST: RequestHandler; }; authenticationVerify: { POST: RequestHandler; }; list: { GET: RequestHandler; }; item: { DELETE: RequestHandler; PATCH: RequestHandler; }; };