Methods are exposed on the cordova.tsido object, which is available after the deviceready event.
initializeSDK, initialize, startJourney, startMobileApproveJourney, submitClientResponse, generateDebugPin, setLoggingEnabled, and setPushToken return a Promise that resolves with true when the native call is accepted (generateDebugPin resolves with a PIN string). Journey steps, instructions, and journey errors arrive on the listener from addJourneyResponseListener, not on those Promises.
Promise rejections are { code, message }. See Promise rejection codes.
▸ initializeSDK(configurationFile?): Promise<boolean>
Initializes the plugin from TransmitSecurity.plist on iOS or from strings.xml on Android. configurationFile is the iOS plist basename and defaults to TransmitSecurity. Android ignores it.
| Name | Type | Description |
|---|---|---|
configurationFile? | string | iOS plist basename. Defaults to TransmitSecurity. |
Promise<boolean>
Resolves with true.
await cordova.tsido.initializeSDK('TransmitSecurity');▸ initialize(clientId, options?): Promise<boolean>
Initializes the plugin with an explicit client ID.
| Name | Type | Description |
|---|---|---|
clientId | string | Client ID from the app in the Admin Portal |
options? | InitializeOptions | Server path and optional SDK settings |
Promise<boolean>
Resolves with true.
await cordova.tsido.initialize('YOUR_CLIENT_ID', {
serverPath: 'https://api.transmitsecurity.io',
collectRiskData: false, // Set to true when the journey uses Risk Level Analysis
});▸ setLoggingEnabled(enabled): Promise<boolean>
Turns native logging and the plugin's JavaScript logging on or off. Logging is off by default. JavaScript lines are prefixed TSIdo: and use a single-string console.log. On iOS, WKWebView bridges console.log to the Xcode console reliably when it has one string argument.
| Name | Type | Description |
|---|---|---|
enabled | boolean | true sets the native log level to debug and enables JavaScript logging |
Promise<boolean>
Resolves with true.
await cordova.tsido.setLoggingEnabled(true);▸ addJourneyResponseListener(listener): { remove: () => boolean }
Registers a listener for journey events. Call this before startJourney. This method is synchronous.
The plugin buffers events until the first listener attaches, up to 50 events, so a response produced during startup is delivered. Register the listener yourself. Do not rely on the buffer.
The listener receives a JourneyEvent.
| Name | Type | Description |
|---|---|---|
listener | (event: JourneyEvent) => void | Called for each journey response, instruction, or error |
{ remove: () => boolean }
remove() unsubscribes this listener and returns whether it was still registered.
function onJourneyEvent(event) {
switch (event.type) {
case 'response':
return onStep(event.response);
case 'instruction':
return console.log(event.instruction.type);
case 'error':
return console.error(event.error.code, event.error.message);
}
}
const subscription = cordova.tsido.addJourneyResponseListener(onJourneyEvent);▸ removeJourneyResponseListener(listener): boolean
Removes a listener previously passed to addJourneyResponseListener. This method is synchronous.
| Name | Type | Description |
|---|---|---|
listener | function | The same function reference that was registered |
boolean
true when the listener was removed.
cordova.tsido.removeJourneyResponseListener(onJourneyEvent);▸ removeAllJourneyResponseListeners(): void
Removes every journey response listener. This method is synchronous.
cordova.tsido.removeAllJourneyResponseListeners();▸ startJourney(journeyId, options?): Promise<boolean>
Starts a journey. A resolved Promise means the request was accepted. The first step arrives on the listener.
| Name | Type | Description |
|---|---|---|
journeyId | string | Journey ID from the Admin Portal |
options? | StartJourneyOptions | Flow ID, additional parameters, encryption, and an optional Fraud Prevention session token |
Promise<boolean>
Resolves with true.
await cordova.tsido.startJourney('my_journey_id', {
flowId: 'optional-flow-id',
additionalParams: { tenant: 'acme' },
encryptionMode: false,
});▸ startMobileApproveJourney(payload, options?): Promise<boolean>
Starts a mobile approve journey from a received push data payload. Pass the payload through as your push library delivered it. On Android the SDK takes a Map<String, String>, so non-string values are stringified. On iOS the payload is passed through as-is.
If payload has no request id, the journey fails with missingRequestIdInApprovalPayload.
This plugin does not register for push. Delivering the token and the notification is the app's job.
| Name | Type | Description |
|---|---|---|
payload | Object | Push notification data payload |
options? | StartJourneyOptions | Same options as startJourney |
Promise<boolean>
Resolves with true.
await cordova.tsido.startMobileApproveJourney(pushData, { flowId: 'optional' });▸ submitClientResponse(responseId, data?): Promise<boolean>
Answers the current journey step. responseId is a built-in RESPONSE_OPTIONS value or a custom option id from response.clientResponseOptions.
errorData on an otherwise normal response (for example a wrong one-time passcode) is a retryable step. Render the step again and surface the message. It is not a journey failure.
| Name | Type | Description |
|---|---|---|
responseId | string | clientInput, cancel, fail, resend, or a custom option id |
data? | Object | Payload matching that option's schema |
Promise<boolean>
Resolves with true.
await cordova.tsido.submitClientResponse('clientInput', { passcode: '123456' });
await cordova.tsido.submitClientResponse('cancel');
await cordova.tsido.submitClientResponse('fail');
await cordova.tsido.submitClientResponse('resend');
const option = response.clientResponseOptions.myCustomOption;
await cordova.tsido.submitClientResponse(option.id, { /* schema fields */ });▸ generateDebugPin(): Promise<string>
Returns a debug PIN for a journey paused on a debug break.
Promise<string>
const pin = await cordova.tsido.generateDebugPin();▸ setPushToken(token): Promise<boolean>
Registers the push token used for mobile approve. Use the APNs token on iOS and the FCM token on Android.
| Name | Type | Description |
|---|---|---|
token | string | APNs token on iOS, FCM token on Android |
Promise<boolean>
Resolves with true.
await cordova.tsido.setPushToken(token);These code values are on Promise rejections. They cover missing arguments and synchronous SDK failures. Network and server errors for a running journey arrive as { type: 'error' } on the listener. See JourneyEvent.
| Code | Cause |
|---|---|
INVALID_ARGS | A required argument was missing or empty |
SDK_INIT_ERROR | initializeSDK or initialize failed |
START_JOURNEY_ERROR | The SDK rejected startJourney synchronously |
START_MOBILE_APPROVE_ERROR | The SDK rejected startMobileApproveJourney |
SUBMIT_RESPONSE_ERROR | The SDK rejected submitClientResponse |
GENERATE_DEBUG_PIN_ERROR | generateDebugPin failed |
SET_PUSH_TOKEN_ERROR | setPushToken failed |
try {
await cordova.tsido.startJourney(journeyId);
} catch (e) {
console.error(e.code, e.message);
}