Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tkhq/sdk/llms.txt
Use this file to discover all available pages before exploring further.
@turnkey/webauthn-stamper stamps Turnkey API requests using a WebAuthn credential (passkey). When a request is about to be sent, the stamper calls the browser’s WebAuthn API to prompt the user for a passkey assertion. The resulting signature is attached to the request as the X-Stamp-Webauthn header.
This is the recommended stamper for browser-based applications where you want users to authenticate with their own passkey rather than a server-controlled API key.
Passkeys created on iOS, Android, and modern desktop browsers are fully supported. Cross-device passkey sync via iCloud Keychain, Google Password Manager, and 1Password is also supported wherever the browser exposes it through the WebAuthn API.
Installation
Usage
TurnkeyClient method, the browser’s WebAuthn dialog appears and the user approves the request with their passkey:
WebauthnStamper constructor
The Relying Party ID for your origin. For
https://www.example.com the RPID is typically example.com. For local development use localhost.How long (in milliseconds) the browser waits for the user to respond to the passkey prompt before the assertion times out. Defaults to 5 minutes.
The user verification requirement passed to the WebAuthn API. Accepts
"required", "preferred", or "discouraged". Defaults to "preferred".An optional list of credential descriptors to pass to
navigator.credentials.get. When empty the browser presents all available passkeys for the RPID. Pass specific credential IDs to constrain which passkey the user is prompted for.How passkey signing works
Challenge derivation
The stamper SHA-256 hashes the serialized request payload and encodes it as a UTF-8 byte array. This becomes the WebAuthn
challenge.WebAuthn assertion
The stamper calls
navigator.credentials.get with the challenge. The browser prompts the user to authenticate with their passkey (biometric, PIN, or security key).Stamp construction
The resulting assertion —
authenticatorData, clientDataJSON, credentialId, and signature — is serialized to JSON and attached as the X-Stamp-Webauthn header value.Local development
SetrpId: "localhost" when running your application locally. WebAuthn requires a secure context (https:// or localhost), so passkeys will not work on plain HTTP origins other than localhost.