webauthn

Overview

The webauthn module allows you to easily login users with biometrics based on the Mosaic WebAuthn APIs. The SDK does all the heavy lifting to provide secure WebAuthn authentication while leaving you the flexibility to control the authentication logic and user experience.

The SDK offers many advantages over the APIs, including:

  • Orchestration functionality to support decisions and complex flows
  • Client-side WebAuthn calls, along with data processing before and after
  • Simplifies all calls to the Mosaic Service, reducing unnecessary complexity

Type Aliases

ApiCrossDeviceStatusResponse

Ƭ ApiCrossDeviceStatusResponse: ApiCrossDeviceStatusResponse


AuthenticationAutofillActivateHandlers

Ƭ AuthenticationAutofillActivateHandlers: AuthenticationAutofillActivateHandlers


AutofillHandlers

Ƭ AutofillHandlers: AutofillHandlers


CrossDeviceAuthenticationHandlers

Ƭ CrossDeviceAuthenticationHandlers: CrossDeviceAuthenticationHandlers


CrossDeviceController

Ƭ CrossDeviceController: CrossDeviceController


CrossDeviceRegistrationHandlers

Ƭ CrossDeviceRegistrationHandlers: CrossDeviceRegistrationHandlers


ErrorCode

Ƭ ErrorCode: ErrorCode


SdkError

Ƭ SdkError: SdkError


WebauthnApis

Ƭ WebauthnApis: WebauthnApis


WebauthnAuthenticationFlows

Ƭ WebauthnAuthenticationFlows: WebauthnAuthenticationFlows


WebauthnCrossDeviceFlows

Ƭ WebauthnCrossDeviceFlows: WebauthnCrossDeviceFlows


WebauthnCrossDeviceRegistrationOptions

Ƭ WebauthnCrossDeviceRegistrationOptions: WebauthnCrossDeviceRegistrationOptions


WebauthnCrossDeviceStatus

Ƭ WebauthnCrossDeviceStatus: WebauthnCrossDeviceStatus


WebauthnRegistrationOptions

Ƭ WebauthnRegistrationOptions: WebauthnRegistrationOptions

Variables

ErrorCode

ErrorCode: typeof ErrorCode


WebauthnCrossDeviceStatus

WebauthnCrossDeviceStatus: typeof WebauthnCrossDeviceStatus


authenticate

Const authenticate: typeof authenticate


crossDevice

Const crossDevice: typeof crossDevice

Functions

getDefaultPaths

getDefaultPaths(): WebauthnApis

Returns the default API paths for webauthn

Returns

WebauthnApis


isAutofillSupported

isAutofillSupported(): Promise<boolean>

Indicates whether this browser supports Passkey Autofill

Returns

Promise<boolean>


isPlatformAuthenticatorSupported

isPlatformAuthenticatorSupported(): Promise<boolean>

Indicates whether this browser supports WebAuthn, and has a platform authenticator

Returns

Promise<boolean>


register

register(username, options?): Promise<string>

Invokes a WebAuthn credential registration for the specified user, including prompting the user for biometrics. If registration is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the relevant backend registration endpoint to complete the registration for either a logged-in user or logged-out user.

If registration fails, an SdkError will be thrown.

Throws

NotInitialized

Throws

RegistrationFailed

Throws

RegistrationCanceled

Parameters

Name Type Description
username string WebAuthn username to register
options? WebauthnRegistrationOptions Additional configuration for registration flow

Returns

Promise<string>