Skip to content

Authentication

Utility functions and types for WebAuthn authentication ceremonies (signing and verification).

Functions

NameDescription
Authentication.deserializeOptionsDeserializes credential request options that can be passed to navigator.credentials.get().
Authentication.deserializeResponseDeserializes a serialized authentication response.
Authentication.getOptionsReturns the request options to sign a challenge with the Web Authentication API.
Authentication.getSignPayloadConstructs the final digest that was signed and computed by the authenticator. This payload includes the cryptographic challenge, as well as authenticator metadata (authenticatorData + clientDataJSON). This value can be also used with raw P256 verification (such as P256.verify or WebCryptoP256.verify).
Authentication.serializeOptionsSerializes credential request options into a JSON-serializable format, converting BufferSource fields to base64url strings.
Authentication.serializeResponseSerializes an authentication response into a JSON-serializable format, converting BufferSource fields to base64url strings and the signature to a hex string.
Authentication.signSigns a challenge using a stored WebAuthn P256 Credential. If no Credential is provided, a prompt will be displayed for the user to select an existing Credential that was previously registered.
Authentication.verifyVerifies a signature using the Credential's public key and the challenge which was signed.

Errors

NameDescription
Authentication.SignFailedErrorThrown when a WebAuthn P256 credential request fails.

Types

NameDescription
Authentication.ResponseResponse from a WebAuthn authentication ceremony.