# Authentication

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

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Authentication.deserializeOptions`](/webauthn/webauthn/Authentication/deserializeOptions) | Deserializes credential request options that can be passed to `navigator.credentials.get()`. |
| [`Authentication.deserializeResponse`](/webauthn/webauthn/Authentication/deserializeResponse) | Deserializes a serialized authentication response. |
| [`Authentication.getOptions`](/webauthn/webauthn/Authentication/getOptions) | Returns the request options to sign a challenge with the Web Authentication API. |
| [`Authentication.getSignPayload`](/webauthn/webauthn/Authentication/getSignPayload) | Constructs 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.serializeOptions`](/webauthn/webauthn/Authentication/serializeOptions) | Serializes credential request options into a JSON-serializable format, converting `BufferSource` fields to base64url strings. |
| [`Authentication.serializeResponse`](/webauthn/webauthn/Authentication/serializeResponse) | Serializes an authentication response into a JSON-serializable format, converting `BufferSource` fields to base64url strings and the signature to a hex string. |
| [`Authentication.sign`](/webauthn/webauthn/Authentication/sign) | Signs 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.verify`](/webauthn/webauthn/Authentication/verify) | Verifies a signature using the Credential's public key and the challenge which was signed. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Authentication.SignFailedError`](/webauthn/webauthn/Authentication/errors#authenticationsignfailederror) | Thrown when a WebAuthn P256 credential request fails. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Authentication.Response`](/webauthn/webauthn/Authentication/types#authenticationresponse) | Response from a WebAuthn authentication ceremony. |
