/** * Standard WebAuthn response shapes (web platform). * * These match the JSON shapes a WebAuthn relying-party server expects — and that the * companion `webauthn-server-buildkit` verifies — i.e. the serialized form of a * `PublicKeyCredential` returned by `navigator.credentials.create()` / `.get()`. * * IMPORTANT: a completed WebAuthn ceremony on the client is NOT proof of identity. * The relying-party SERVER must verify the returned response against the challenge it * issued. Pass these objects to your server (e.g. `webauthn-server-buildkit`) to verify. */ /** Base64URL-encoded string (URL-safe alphabet, no padding). */ export type Base64URLString = string; /** Registration (attestation) response — output of `navigator.credentials.create()`. */ export interface WebAuthnRegistrationResponseJSON { id: Base64URLString; rawId: Base64URLString; type: 'public-key'; authenticatorAttachment?: 'platform' | 'cross-platform'; clientExtensionResults: Record; response: { clientDataJSON: Base64URLString; attestationObject: Base64URLString; transports?: string[]; }; } /** Authentication (assertion) response — output of `navigator.credentials.get()`. */ export interface WebAuthnAuthenticationResponseJSON { id: Base64URLString; rawId: Base64URLString; type: 'public-key'; authenticatorAttachment?: 'platform' | 'cross-platform'; clientExtensionResults: Record; response: { clientDataJSON: Base64URLString; authenticatorData: Base64URLString; signature: Base64URLString; userHandle?: Base64URLString; }; } /** Any WebAuthn response the web adapter can return. */ export type WebAuthnResponseJSON = WebAuthnRegistrationResponseJSON | WebAuthnAuthenticationResponseJSON;