FakeAuthenticator
In-memory platform authenticator producing cryptographically valid WebAuthn responses (ES256, attestation "none"), so they pass real server verifiers.
Like a platform authenticator it checks the options' RP ID against origin: an http(s) origin's host must equal the RP ID or be a subdomain of it (otherwise PasskeyError.Misconfigured); for other origins (e.g. Android android:apk-key-hash:...) the options must name the RP ID explicitly (otherwise PasskeyError.InvalidOptions).
Safe to call from concurrent coroutines: every operation runs under one lock.
Extensions: prf and largeBlob are supported (toggle with prfSupported / largeBlobSupported); outputs appear in clientExtensionResults as on real platforms. PRF is deterministic and test-only: HMAC-SHA256(secret, SHA-256("WebAuthn PRF" || 0x00 || salt)), mirroring the WebAuthn salt hashing, where secret is derived from the credential id (so it is predictable; never use this as real key material). The same passkey and salt always give the same 32 bytes; different salts or passkeys give different ones. Large blobs are kept in memory per passkey (FakeCredential.largeBlob).
Properties
Whether new passkeys can get large-blob storage. When false, registration reports largeBlob.supported = false, or fails with PasskeyError.NotSupported if support is required. Default true. Set from test code, not concurrently with operations.
Whether the prf extension is supported. When false, registration reports prf.enabled = false and sign-in returns no PRF results. Default true. Set from test code, not concurrently with operations.
Snapshot of the passkeys currently stored, oldest first.
Functions
Deletes the passkey with base64url credentialId on rpId, if stored. Ids are compared by their bytes (padding and standard-alphabet ids match). Throws PasskeyException with PasskeyError.InvalidOptions for an undecodable id.
Deletes every passkey of userHandle on rpId whose id is not in credentialIds. Ids are compared by their bytes. Throws PasskeyException with PasskeyError.InvalidOptions for an undecodable id.
Signs request options optionsJson with the most recent matching passkey and returns AuthenticationResponseJSON. Throws PasskeyException with PasskeyError.NoCredentials if none matches, PasskeyError.InvalidOptions for malformed options, or PasskeyError.Misconfigured if the RP ID does not match origin.