1import type { PasskeyCeremonyResult } from "./PasskeyBridge.ts";
2
3/** What the shared bridge has already checked before a backend runs a ceremony. */
4export interface PasskeyCeremonyContext {
5 /** The committed origin of the frame that asked; never the page's own claim. */
6 readonly origin: string;
7 /** The window the system sheet attaches to. */
8 readonly nativeWindowHandle: Buffer;
9}
10
11/**
12 * One platform's way to create and use passkeys for a preview page. The
13 * bridge in `Passkeys.ts` owns everything platform-neutral: which frame may
14 * ask, focus, one ceremony at a time, the deadline, and dropping results for
15 * a page that navigated away. A backend only talks to the platform.
16 */
17export interface PasskeyBackend {
18 readonly create: (
19 publicKey: PublicKeyCredentialCreationOptions,
20 context: PasskeyCeremonyContext,
21 ) => Promise<PasskeyCeremonyResult>;
22 readonly get: (
23 publicKey: PublicKeyCredentialRequestOptions,
24 context: PasskeyCeremonyContext,
25 ) => Promise<PasskeyCeremonyResult>;
26}