Skip to content

Functions

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

▸ 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.

Parameters

NameTypeDescription
configurationFile?stringiOS plist basename. Defaults to TransmitSecurity.

Returns

Promise<boolean>

Resolves with true.

Example

await cordova.tsido.initializeSDK('TransmitSecurity');

initialize

▸ initialize(clientId, options?): Promise<boolean>

Initializes the plugin with an explicit client ID.

Parameters

NameTypeDescription
clientIdstringClient ID from the app in the Admin Portal
options?InitializeOptionsServer path and optional SDK settings

Returns

Promise<boolean>

Resolves with true.

Example

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

▸ 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.

Parameters

NameTypeDescription
enabledbooleantrue sets the native log level to debug and enables JavaScript logging

Returns

Promise<boolean>

Resolves with true.

Example

await cordova.tsido.setLoggingEnabled(true);

addJourneyResponseListener

▸ 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.

Parameters

NameTypeDescription
listener(event: JourneyEvent) => voidCalled for each journey response, instruction, or error

Returns

{ remove: () => boolean }

remove() unsubscribes this listener and returns whether it was still registered.

Example

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

▸ removeJourneyResponseListener(listener): boolean

Removes a listener previously passed to addJourneyResponseListener. This method is synchronous.

Parameters

NameTypeDescription
listenerfunctionThe same function reference that was registered

Returns

boolean

true when the listener was removed.

Example

cordova.tsido.removeJourneyResponseListener(onJourneyEvent);

removeAllJourneyResponseListeners

▸ removeAllJourneyResponseListeners(): void

Removes every journey response listener. This method is synchronous.

Example

cordova.tsido.removeAllJourneyResponseListeners();

startJourney

▸ startJourney(journeyId, options?): Promise<boolean>

Starts a journey. A resolved Promise means the request was accepted. The first step arrives on the listener.

Parameters

NameTypeDescription
journeyIdstringJourney ID from the Admin Portal
options?StartJourneyOptionsFlow ID, additional parameters, encryption, and an optional Fraud Prevention session token

Returns

Promise<boolean>

Resolves with true.

Example

await cordova.tsido.startJourney('my_journey_id', {
  flowId: 'optional-flow-id',
  additionalParams: { tenant: 'acme' },
  encryptionMode: false,
});

startMobileApproveJourney

▸ 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.

Parameters

NameTypeDescription
payloadObjectPush notification data payload
options?StartJourneyOptionsSame options as startJourney

Returns

Promise<boolean>

Resolves with true.

Example

await cordova.tsido.startMobileApproveJourney(pushData, { flowId: 'optional' });

submitClientResponse

▸ 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.

Parameters

NameTypeDescription
responseIdstringclientInput, cancel, fail, resend, or a custom option id
data?ObjectPayload matching that option's schema

Returns

Promise<boolean>

Resolves with true.

Example

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

▸ generateDebugPin(): Promise<string>

Returns a debug PIN for a journey paused on a debug break.

Returns

Promise<string>

Example

const pin = await cordova.tsido.generateDebugPin();

setPushToken

▸ setPushToken(token): Promise<boolean>

Registers the push token used for mobile approve. Use the APNs token on iOS and the FCM token on Android.

Parameters

NameTypeDescription
tokenstringAPNs token on iOS, FCM token on Android

Returns

Promise<boolean>

Resolves with true.

Example

await cordova.tsido.setPushToken(token);

Promise rejection codes

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.

CodeCause
INVALID_ARGSA required argument was missing or empty
SDK_INIT_ERRORinitializeSDK or initialize failed
START_JOURNEY_ERRORThe SDK rejected startJourney synchronously
START_MOBILE_APPROVE_ERRORThe SDK rejected startMobileApproveJourney
SUBMIT_RESPONSE_ERRORThe SDK rejected submitClientResponse
GENERATE_DEBUG_PIN_ERRORgenerateDebugPin failed
SET_PUSH_TOKEN_ERRORsetPushToken failed
try {
  await cordova.tsido.startJourney(journeyId);
} catch (e) {
  console.error(e.code, e.message);
}