Overview

The Webauthn module is a part of a client-side JavaScript SDK. It allows you to easily log in users with biometrics based on the 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.

Benefits

The SDK offers many advantages over the APIs, including:

  • Journey orchestration to support decisions and complex flows
  • Client-side WebAuthn calls, along with data processing before and after
  • Simplifies calls to Mosaic, reducing unnecessary complexity

Installation

Load the SDK:

Step 1: Load the SDK

You can load the SDK in one of two ways:

  • Using a script tag (CDN) :
    Copy
    Copied
    <script src="https://platform-websdk.transmitsecurity.io/platform-websdk/1.x/ts-platform-websdk.js" id="platform-sdk"></script>
    info

    When using the script tag, all functions must be invoked inside window.tsPlatform.
    This applies only to the CDN method.

  • Using a package manager :

    With npm:

    Copy
    Copied
    npm install @transmitsecurity/platform-web-sdk@^1

    or alternatively with Yarn:

    Copy
    Copied
    yarn add @transmitsecurity/platform-web-sdk@^1

Initialization

To initialize, activate the following code:

Copy
Copied
import { webauthn } from '@transmitsecurity/platform-web-sdk';

// Initialize an instance of the WebAuthn SDK using the unified SDK
// If SDK was loaded via script tag, invoke functions inside 'window.tsPlatform'
await initialize({
    clientId: '[CLIENT_ID]',
    webauthn: {serverPath: 'https://api.transmitsecurity.io'} // Optional for US region
});

Customizations:

Name Type Description
serverPath string By default, the SDK is initialized for US-based (global) cluster. The WebAuthn module can be configured to work with a different cluster or proxy by setting serverPath to https://api.eu.transmitsecurity.io (for EU) or https://api.ca.transmitsecurity.io (for Canada). For the SDK modules to work properly together, the regions must match.
webauthnApiPaths? WebauthnApis Override endpoints when using a proxy server in case the proxy server implements its own paths.

For more information, refer to the class reference, as well as the Quick start guide.