Overview
Thewebauthn sub-client manages FIDO2/WebAuthn passkey credentials for your end-users. You can generate registration options, verify registration responses, list credentials, and delete them.
webauthn.registerOptions()
Generate WebAuthn registration options for a principal. Returns aPublicKeyCredentialCreationOptions-compatible object that you pass to navigator.credentials.create() in the browser.
Parameters
The ID of the principal (end-user) to register a passkey for.
Response: WebAuthnRegisterOptions
Base64url-encoded challenge for the registration ceremony.
Relying party information (
name, id).User entity (
id, name, displayName) for the credential.Supported public key algorithms (e.g., ES256, RS256).
Timeout in milliseconds for the registration ceremony.
Attestation conveyance preference (
'none', 'indirect', 'direct').List of existing credential descriptors to prevent re-registration.
webauthn.registerVerify()
Verify a WebAuthn registration response from the browser. On success, the credential is stored and associated with the principal.Parameters
The principal ID that this credential belongs to.
The WebAuthn attestation response from
navigator.credentials.create(). Must include id, rawId, type, and response (with clientDataJSON and attestationObject).Response: WebAuthnCredential
Unique credential identifier.
Base64url-encoded public key.
The signature counter (starts at 0).
ISO 8601 timestamp when the credential was registered.
The authenticator attestation GUID, identifying the authenticator model.
webauthn.listCredentials()
List all WebAuthn credentials registered for a principal.Parameters
The principal ID to list credentials for.
Response: WebAuthnCredential[]
Returns an array of WebAuthnCredential objects.
Unique credential identifier.
Base64url-encoded public key.
Current signature counter value.
ISO 8601 timestamp when the credential was registered.
ISO 8601 timestamp of the last successful authentication, or
null if never used.webauthn.deleteCredential()
Delete a WebAuthn credential by its ID. The credential is immediately invalidated.Parameters
The credential ID to delete.
Response
Returnsvoid. The credential is immediately removed and can no longer be used for authentication.