Introduction

The Platform SDK is a JavaScript client SDK that lets you quickly integrate easy and secure identity experiences into your web application. It offers Fraud Prevention, biometric WebAuthn authentication, Orchestration with journeys, and more to come.

Modules

The SDK is comprised of different modules. Modules are currently available for the following services:

Versioning

The Platform SDK is versioned according to the semantic versioning standard where X.Y.Z. corresponds to Major.Minor.Patch. The SDK version can be specified as:

  • Specific version, such as 1.13.6
  • Version range, such as 1.x or 1.15.x

For more information on versioning, see Versioning and Changelog.

Installation

The Platform SDK can be installed using one of the following methods: CDN or NPM. For more import options, including tree-shaking, see Installation.

CDN installation

To load the SDK via CDN, include the following HTML script tag in all the relevant pages of your front-end web application:

Copy
Copied
<!-- This loads the latest SDK within the major version 1. Specify a different version if necessary -->
<script src="https://platform-websdk.transmitsecurity.io/platform-websdk/1.x/ts-platform-websdk.js" defer="true" id="ts-platform-script"></script>

Then add the code below to wait for the SDK loading event:

Copy
Copied
document.getElementById('ts-platform-script').addEventListener('load', () => {
  // do here things with `tsPlatform`
});
Note

Call functions inside window.tsPlatform property.

NPM installation

Load the SDK from the npm registry.

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

Then add the code below to import required packages:

Copy
Copied
// Imports all modules as a single namespace
import * as sdk from '@transmitsecurity/platform-web-sdk';

For details on individual module import, see Installation.

Initialization

Configure the SDK globally for all the modules by calling the initialize() SDK method, as in the example below.

Important

When using multiple modules, always use a single initialize call.

Use the initialization method that matches your installation. CDN is recommended for rapid testing and static pages. NPM is recommended for production-grade apps and modern front-end frameworks.

CDN initialization

Use this method if you loaded the SDK using the CDN script tag. This approach is recommended for quick testing or static front-end applications.

Copy
Copied
// CDN installation – initialize via the global tsPlatform object
await window.tsPlatform.initialize({
  clientId: 'your-client-id',
  drs: {
    serverPath: 'https://api.transmitsecurity.io/risk-collect/' // US region; for EU or CA use the corresponding base URL
  },
  ido: {
    serverPath: 'https://api.transmitsecurity.io/ido' // US region; for EU or CA use the corresponding base URL
  },
  idv: {
    serverPath: 'https://api.transmitsecurity.io/verify' // US region; for EU or CA use the corresponding base URL
  },
  webauthn: {
    serverPath: 'https://api.transmitsecurity.io'// US region; for EU or CA use the corresponding base URL
  }
});

// Example usage after initialization
await window.tsPlatform.drs.triggerActionEvent('login', { correlationId: 'example' });
const isSupported = await window.tsPlatform.webauthn.isPlatformAuthenticatorSupported();

NPM initialization

Use this method if you installed the SDK via NPM. This approach is recommended for production applications using build tools or modern frameworks.

Copy
Copied
import { initialize, drs, webauthn, ido, idv } from '@transmitsecurity/platform-web-sdk';

// Configures the SDK with your client ID
// If SDK was loaded via script tag, invoke functions inside 'window.tsPlatform'
await initialize({ 
  clientId: 'your-client-id', // Client ID from app settings in the Admin Portal
  drs: {
    serverPath: 'https://api.transmitsecurity.io/risk-collect/' // US region; for EU or CA use the corresponding base URL
  },
  ido: {
    serverPath: 'https://api.transmitsecurity.io/ido' // US region; for EU or CA use the corresponding base URL
  },
  idv: {
    serverPath: 'https://api.transmitsecurity.io/verify' // US region; for EU or CA use the corresponding base URL
  },
  webauthn: {
    serverPath: 'https://api.transmitsecurity.io' // US region; for EU or CA use the corresponding base URL
  }
});

// Triggers an action event using the DRS module
const { actionToken } = await drs.triggerActionEvent('login', { correlationId: 'example' });

// Checks if the platform authenticator is supported using the WebAuthn module
const isSupported = await webauthn.isPlatformAuthenticatorSupported();
Note

The SDK modules can be configured to work with a different cluster or proxy by setting serverPath for each module individually. For the SDK to work properly, the regions must match.

Next steps

For other customizations, see a reference for your specific module: