Installation

The Platform SDK can be installed using two primary methods: CDN and NPM.

CDN installation

CDN installation is recommended for rapid prototying and testing. Load the SDK directly via CDN by adding the following HTML <script> tag in all relevant pages:

Copy
Copied
<!-- Load the latest SDK within major version 1 -->
<script src="https://platform-websdk.transmitsecurity.io/platform-websdk/1.x/ts-platform-websdk.js" defer="true" id="ts-platform-script"></script>

Wait for the SDK to load before using it:

Copy
Copied
document.getElementById('ts-platform-script').addEventListener('load', () => {
  // SDK is ready- initialize and use tsPlatform
  // Invoke functions inside 'window.tsPlatform'
  window.tsPlatform.initialize({
    clientId: 'your-client-id',
    drs: {
      serverPath: 'https://api.transmitsecurity.io/risk-collect/'
    },
    ido: {
      serverPath: 'https://api.transmitsecurity.io/ido'
    },
    idv: {
      serverPath: 'https://api.transmitsecurity.io/verify'
    },
    webauthn: {
      serverPath: 'https://api.transmitsecurity.io'
    }
  });
});
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.

NPM installation

  1. Load the SDK via a package manager:
npmyarn
Copy
Copied
npm install @transmitsecurity/platform-web-sdk@^1
Copy
Copied
yarn add @transmitsecurity/platform-web-sdk@^1
  1. Depending on your tasks, import one or several modules. Using individual module imports (e.g., @transmitsecurity/platform-web-sdk/drs ) instead of the full SDK import helps reduce your bundle size. This dramatically improves page load times and user experience.

You can install and use the Platform SDK in different ways, depending on your needs:

  • Import specific functions from individual subpaths (recommended) : Ideal when you need only a few SDK features. It includes only the functions you import, requires no initialization, and keeps the bundle small—great for faster load times and better performance on mobile or slow networks.
  • Import individual modules : Best for most use cases. It supports tree-shaking to exclude unused modules and keeps overhead low, balancing flexibility and performance.
  • Import multiple modules : Use this if you need to configure modules separately or support legacy code. Tree-shaking is less effective, and some modules must be instantiated, which increases bundle size.

Import specific functions from individual subpaths (recommended)

Use this approach when you only need a few specific SDK functions and want the smallest possible bundle. Initialization is not required.

Note

The functions shown are examples only. For the full list of functions in each module, see that module’s SDK reference.

Copy
Copied
// Import DRS functions
import { triggerActionEvent, setUser } from '@transmitsecurity/platform-web-sdk/drs';
// Import IDO functions
import { startJourney, performAction } from '@transmitsecurity/platform-web-sdk/ido';
// Import IDV functions
import { start, recapture } from '@transmitsecurity/platform-web-sdk/idv';
// Import Webauthn functions
import { authenticate, register } from '@transmitsecurity/platform-web-sdk/webauthn';

// No need to call initialize if you're importing functions directly
await triggerActionEvent('login');
await startJourney({ /* ... */ });
wait start({ /* ... */ });
await authenticate({ /* ... */ });
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.

Import individual modules

Use this when you need multiple modules with minimal overhead. Tree-shaking removes any unused modules after a single initialize() call.

Copy
Copied
// Import the Platform SDK modules and initialize function directly.
import { drs, webauthn, idv, ido, initialize } from '@transmitsecurity/platform-web-sdk';

// Initialize all required modules in a single call.
// This is required to ensure correct SDK lifecycle handling.
await initialize({
  clientId: 'your-client-id',
  drs: {
    serverPath: 'https://api.transmitsecurity.io/risk-collect/'
  },
  ido: {
    serverPath: 'https://api.transmitsecurity.io/ido'
  },
  idv: {
    serverPath: 'https://api.transmitsecurity.io/verify'
  },
  webauthn: {
    serverPath: 'https://api.transmitsecurity.io'
  }
});

// Modules are ready to use directly
await drs.triggerActionEvent('login');
await ido.performAction({ /* ... */ });
await idv.start({ /* ... */ });
await webauthn.authenticate({ /* ... */ });

Import multiple modules

Use this when you want to configure modules separately or are maintaining existing code that uses class-based SDK instances.

Important

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

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

// Single initialize call with configuration for all modules
await initialize({
  clientId: 'your-client-id',
  ido: {
    serverPath: 'https://api.transmitsecurity.io/ido'
  },
  webauthn: {
    serverPath: 'https://api.transmitsecurity.io'
  }
});
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.