Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

§Classes

WebAuthnAbortService

WebAuthn abort service to manage ceremony cancellation. Ensures only one WebAuthn ceremony is active at a time to prevent "operation already in progress" errors.

WebAuthnApi

WebAuthn API wrapper for Supabase Auth. Provides methods for enrolling, challenging, verifying, authenticating, and registering WebAuthn credentials.

WebAuthnError

A custom Error used to return a more nuanced error detailing why one of the eight documented errors in the spec was raised after calling navigator.credentials.create() or navigator.credentials.get():

§Variables

DEFAULT_CREATION_OPTIONS
DEFAULT_REQUEST_OPTIONS
webAuthnAbortService

Singleton instance to ensure only one WebAuthn ceremony is active at a time. This prevents "operation already in progress" errors when retrying WebAuthn operations.

§Functions

createCredential

Create a WebAuthn credential using the browser's credentials API. Wraps navigator.credentials.create() with error handling.

deserializeCredentialCreationOptions

Convert base64url encoded strings in WebAuthn credential creation options to ArrayBuffers as required by the WebAuthn browser API. Supports both native WebAuthn Level 3 parseCreationOptionsFromJSON and manual fallback.

deserializeCredentialRequestOptions

Convert base64url encoded strings in WebAuthn credential request options to ArrayBuffers as required by the WebAuthn browser API. Supports both native WebAuthn Level 3 parseRequestOptionsFromJSON and manual fallback.

getCredential

Get a WebAuthn credential using the browser's credentials API. Wraps navigator.credentials.get() with error handling.

identifyAuthenticationError

Attempt to intuit why an error was raised after calling navigator.credentials.get(). Maps browser errors to specific WebAuthn error codes for better debugging.

identifyRegistrationError

Attempt to intuit why an error was raised after calling navigator.credentials.create(). Maps browser errors to specific WebAuthn error codes for better debugging.

isValidDomain

A simple test to determine if a hostname is a properly-formatted domain name. Considers localhost valid for development environments.

isWebAuthnError

Type guard to check if an error is a WebAuthnError.

mergeCredentialCreationOptions

Merges WebAuthn credential creation options with overrides. Sets sensible defaults for authenticator selection and extensions.

mergeCredentialRequestOptions

Merges WebAuthn credential request options with overrides. Sets sensible defaults for user verification and hints.

serializeCredentialCreationResponse

Convert a registration/enrollment credential response to server format. Serializes binary fields to base64url for JSON transmission. Supports both native WebAuthn Level 3 toJSON and manual fallback.

serializeCredentialRequestResponse

Convert an authentication/verification credential response to server format. Serializes binary fields to base64url for JSON transmission. Supports both native WebAuthn Level 3 toJSON and manual fallback.

§Interfaces

AuthenticationResponseJSON

A slightly-modified AuthenticationCredential to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

RegistrationResponseJSON

A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that are Base64URL-encoded in the browser so that they can be sent as JSON to the server.

§Type Aliases

ServerCredentialCreationOptions

Server response format for WebAuthn credential creation options. Uses W3C standard JSON format with base64url-encoded binary fields.

ServerCredentialRequestOptions

Server response format for WebAuthn credential request options. Uses W3C standard JSON format with base64url-encoded binary fields.

ServerCredentialResponse

Server format for credential response with base64url-encoded binary fields Can be either a registration or authentication response