Skip to content

Functions

initializeSDK

▸ initializeSDK({configurationFile}): Future<void>

Initializes the SDK using a configuration file (iOS plist or Android auto-detected configuration).

Parameters

NameTypeDescription
configurationFileString?Name of the configuration file (without extension on iOS)

Example

final orchestration = FlutterTsIdentityOrchestration();
await orchestration.initializeSDK(configurationFile: 'TransmitSecurity');

initialize

▸ initialize({clientId, options}): Future<void>

Initializes the SDK with explicit parameters.

Parameters

NameTypeDescription
clientIdStringYour Mosaic client ID
optionsMap<String, dynamic>Configuration options (see below)

Options:

KeyTypeDescription
serverPathStringServer URL (default: https://api.transmitsecurity.io)
resourceString?Custom resource path
pollingTimeoutint?Polling timeout in milliseconds
localeString?Locale setting (default: 'en')

Example

await orchestration.initialize(
  clientId: 'CLIENT_ID',
  options: {
    'serverPath': 'https://api.transmitsecurity.io',
    'pollingTimeout': 30000,
    'locale': 'en',
  },
);

journeyResponseStream

▸ journeyResponseStream: Stream<Map<String, dynamic>>

Stream that delivers real-time journey events. This is the only way the SDK communicates journey responses to your app.

Important

You must listen to this stream before starting any journey. Without an active listener, your app will not receive journey responses—steps, authentication results, and errors will be lost.

Response format

KeyTypeDescription
successboolWhether the response represents a successful step
responseMap?Response data including journeyStepId
errorString?Error message if success is false
typeString?Response type (e.g., 'instructions')
instructionsMap?Additional instructions data when type is 'instructions'

Instructions callback

When calling submitClientResponse or startMobileApproveJourney, the native SDK may trigger additional instructions through the event stream. These are delivered as responses with type set to 'instructions' and should be handled separately from regular journey step responses.

Example

orchestration.journeyResponseStream.listen(
  (response) {
    if (response['type'] == 'instructions') {
      final instructions = response['instructions'];
      // Handle native SDK instructions
      return;
    }

    if (response['success'] == true) {
      final stepId = response['response']?['journeyStepId'];
      // Handle journey step
    } else {
      print('Error: ${response['error']}');
    }
  },
  onError: (error) {
    print('Stream error: $error');
  },
);

startJourney

▸ startJourney({journeyId, options}): Future<void>

Starts an orchestration journey. Responses are delivered via journeyResponseStream.

Parameters

NameTypeDescription
journeyIdStringThe journey identifier configured in the Admin Portal
optionsMap<String, dynamic>?Journey options (see below)

Options:

KeyTypeDescription
additionalParamsMap<String, String>?Additional parameters to pass to the journey
flowIdString?Custom flow identifier
encryptionModebool?Enable encryption for the journey session

Example

await orchestration.startJourney(
  journeyId: 'registration-flow',
  options: {
    'additionalParams': {'userType': 'premium'},
    'encryptionMode': true,
  },
);

submitClientResponse

▸ submitClientResponse({responseId, data}): Future<bool>

Submits a client response during a journey flow. The next step is delivered via journeyResponseStream.

Parameters

NameTypeDescription
responseIdStringIdentifier for the response type
dataMap<String, dynamic>?Data to submit

Common response IDs:

IDDescription
'clientInput'Submit user input
'cancel'Cancel current step
'fail'Mark step as failed
'resend'Request resend (e.g., OTP)

Returns

bool—true if the response was submitted successfully.

Example

await orchestration.submitClientResponse(
  responseId: 'clientInput',
  data: {'email': 'user@example.com', 'password': 'secret'},
);
Platform differences

The response ID for login form submissions may differ between platforms. On Android, use 'password'; on iOS, use 'Password'.

import 'dart:io' show Platform;

final responseId = Platform.isAndroid ? 'password' : 'Password';
await orchestration.submitClientResponse(
  responseId: responseId,
  data: {'username': username, 'password': password},
);

startMobileApproveJourney

▸ startMobileApproveJourney({payload, startJourneyOptions}): Future<void>

Starts a mobile approve journey. Responses are delivered via journeyResponseStream.

Parameters

NameTypeDescription
payloadMap<String, dynamic>Mobile approve payload (e.g., session data)
startJourneyOptionsMap<String, dynamic>Journey options (e.g., encryption settings)

Example

await orchestration.startMobileApproveJourney(
  payload: {'sessionId': 'session-123'},
  startJourneyOptions: {'encrypted': true},
);

generateDebugPin

▸ generateDebugPin(): Future<String>

Generates a debug PIN for development and testing.

Returns

String—the generated debug PIN.

Example

final pin = await orchestration.generateDebugPin();

setLoggingEnabled

▸ setLoggingEnabled(enabled): Future<bool>

Enables or disables SDK logging.

Parameters

NameTypeDescription
enabledbooltrue to enable logging, false to disable

Returns

bool—true if the configuration was applied successfully.

Example

await orchestration.setLoggingEnabled(true);

setPushToken

▸ setPushToken(token): Future<void>

Sets the push notification token for the SDK to enable push-based flows.

Parameters

NameTypeDescription
tokenStringThe push notification token from Firebase or APNs

Example

final token = await FirebaseMessaging.instance.getToken();
if (token != null) {
  await orchestration.setPushToken(token);
}