Transmit Security Web SDK - Browser-only authentication and identity verification
npm install @transmitsecurity/platform-web-sdk
A JavaScript client SDK offering comprehensive identity and security solution with Fraud prevention, WebAuthn authentication, Identity Verification, and Orchestration capabilities.
Installs the latest v2 version:
``bash`
npm install @transmitsecurity/platform-web-sdk@^2
To benefit from tree-shaking, initialize only the modules you need:
`javascript
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
}
});
`
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.
`javascript
// 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:
`typescript
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: 'user@example.com' }
);
`
To leverage namespace calls, import modules from individual subpaths
`javascript
// 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');
`
`javascript
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');
``