@transmitsecurity/platform-web-sdk
v2.1.1
Published
Transmit Security Web SDK - Browser-only authentication and identity verification
Readme
Transmit Security Platform Web SDK
A JavaScript client SDK offering comprehensive identity and security solution with Fraud prevention, WebAuthn authentication, Identity Verification, and Orchestration capabilities.
Installation
Installs the latest v2 version:
npm install @transmitsecurity/platform-web-sdk@^2Initialization
To benefit from tree-shaking, initialize only the modules you need:
import { initialize } from '@transmitsecurity/platform-web-sdk';
initialize({
clientId: 'your-client-id',
drs: {
serverPath: 'https://api.transmitsecurity.io/risk-collect/', // Required: Set serverPath based on your region or custom domain
enableSessionToken: true
},
ido: {
serverPath: 'https://api.transmitsecurity.io/ido' // Required: Set serverPath based on your region or custom domain
},
idv: {
serverPath: 'https://api.transmitsecurity.io/verify' // Required: Set serverPath based on your region or custom domain
},
webauthn: {
serverPath: 'https://api.transmitsecurity.io' // Required: Set serverPath based on your region or custom domain
}
});Usage Patterns
Import Functions from Individual Subpaths (Recommended)
For optimal bundle sizes and performance, import specific functions from individual subpaths:
The functions shown below are examples only. For the full list of functions in each module, see SDK reference.
// Individual function imports
import { triggerActionEvent, setAuthenticatedUser, clearUser, getSessionToken } from '@transmitsecurity/platform-web-sdk/drs';
import { isPlatformAuthenticatorSupported, register } from '@transmitsecurity/platform-web-sdk/webauthn';
import { start } from '@transmitsecurity/platform-web-sdk/idv';
import { startJourney } from '@transmitsecurity/platform-web-sdk/ido';
// Direct function calls
await triggerActionEvent('login', { correlationId: 'example' });
await setAuthenticatedUser('user123');
await getSessionToken();
const isSupported = await isPlatformAuthenticatorSupported();
await startJourney('JOURNEY_ID');
TypeScript Support
Full TypeScript support with individual imports:
import { triggerActionEvent, setAuthenticatedUser, getSessionToken } from '@transmitsecurity/platform-web-sdk/drs';
import { isPlatformAuthenticatorSupported } from '@transmitsecurity/platform-web-sdk/webauthn';
import { start } from '@transmitsecurity/platform-web-sdk/idv';
import { submitClientResponse, ClientResponseOptionType } from '@transmitsecurity/platform-web-sdk/ido';
// Use with proper TypeScript types
await triggerActionEvent('login', { correlationId: 'example' });
await getSessionToken();
const isSupported: boolean = await isPlatformAuthenticatorSupported();
await submitClientResponse(
ClientResponseOptionType.ClientInput,
{ userEmail: '[email protected]' }
);Import Individual Modules
To leverage namespace calls, import modules from individual subpaths
// Individual module imports
import * as drs from '@transmitsecurity/platform-web-sdk/drs';
import * as ido from '@transmitsecurity/platform-web-sdk/ido';
import * as idv from '@transmitsecurity/platform-web-sdk/idv';
import * as webauthn from '@transmitsecurity/platform-web-sdk/webauthn';
// Namespace calls
await drs.triggerActionEvent('login', { correlationId: 'example' });
await drs.setAuthenticatedUser('user123');
await drs.getSessionToken();
const isSupported = await webauthn.isPlatformAuthenticatorSupported();
await ido.startJourney('journey-id');Import Full SDK (Alternative)
If you need multiple modules, you can also import the full SDK:
import { drs, webauthn, idv, ido, initialize } from '@transmitsecurity/platform-web-sdk';
// Use modules through the main object
await drs.triggerActionEvent('login', { correlationId: 'example' });
await drs.getSessionToken();
await ido.startJourney('JOURNEY_ID');