initialize

⚙️ initialize() Method

The initialize method is the first and most critical step in setting up the Ditto ID SDK. It establishes a secure session and begins the onboarding or authentication workflow. This method is asynchronous and its progress is tracked via events.


🎯 Purpose

  • Bootstraps the Ditto ID SDK.
  • Creates a Ditto ID session in the PRIMARY state.
  • Prepares the SDK for secure communication and identity workflows (e.g., onboarding, login).

🚀 Key Characteristics

  • Asynchronous: It does not return a direct response. Progress is reported via SDK events.
  • Event-driven: You must register event listeners before or at the time of calling initialize() to capture lifecycle events.
  • Platform-specific setup: Parameters and listener methods vary slightly across platforms.

📡 Key Events Triggered by initialize()

EventDescription
onInitializeProgressTracks progress (e.g., threat checks, server connection). Includes statuses like STARTED, COMPLETED, INIT_FAILED.
onInitializeErrorReports errors during initialization (e.g., invalid parameters, network issues).
onUserConsentThreatsTriggered if non-terminating threats are detected. App decides whether to proceed using takeActionOnThreats().
onTerminateWithThreatsTriggered for critical threats (configured to terminate). These are blocking issues.
onInitializedIndicates that initialization completed successfully. Returns session metadata and IDV configuration (if available).
getUserTriggered post-initialization when the SDK is ready to accept a user ID. Your app should call setUser() here.

🚀 RDNA Client Initialization (All Frameworks)

Ditto ID SDK must be initialized before using any of its features. Below are platform-specific initialization methods and parameter explanations.


⚛️ React Native
RdClient.initialize(
  currentAgentInfo,
  currentGatewayHost,
  currentGatewayPort,
  cipherSpecs,
  cipherSalt,
  jsonProxySettings,
  sslDetails,
RDNALoggingLevel.RDNA_NO_LOGS,
 InitOptions,
  (syncResponse) => {
    console.log(syncResponse);
  }
);
ParameterTypeDescription
currentAgentInfoStringSoftware identity info for API-runtime authentication.
currentGatewayHostStringHostname or IP of the gateway server.
currentGatewayPortNumberPort number of the gateway server.
cipherSpecsStringFormat: "AES/256/CFB/NoPadding:SHA-256"
cipherSaltStringRecommended: <APPLICATION_PACKAGE_NAME>
jsonProxySettingsString (JSON)Optional proxy settings JSON.
sslDetailsObjectOptional SSL details: base64 cert, password, enableSSL.
RDNALoggingLevelEnumEnum for SDK log level.
InitOptionsString (JSON)Configuration to initializing the SDK.

💡 Developer Tips

  • Always ensure you initialize the SDK before making any other SDK calls.
  • Verify all cryptographic parameters (cipherSpec, cipherSalt) follow the expected format.
  • For production, use RDNA_NO_LOGS to disable verbose logging.
  • If using proxy or SSL certificates, validate configurations and storage security.

💙 Flutter
rdnaClient.initialize(
  AGENT_INFO,
  HOST,
  PORT,
  CIPHERSPECS,
  CIPHER_SALT,
  PROXY_SETTINGS,
  RDNASSLCertificate,
  RDNALoggingLevel.RDNA_NO_LOGS,
  InitOptions: String?,
);
ParameterTypeDescription
AGENT_INFOStringSoftware identity string.
HOSTStringGateway server IP or hostname.
PORTintGateway port.
CIPHERSPECSStringCipher config string.
CIPHER_SALTStringRecommended: <APPLICATION_PACKAGE_NAME>
PROXY_SETTINGSJSON StringOptional proxy info.
RDNASSLCertificateJSON ObjectOptional: base64 cert, password, enableSSL.
RDNALoggingLevelEnumControls logging level.
InitOptionsJSON StringConfiguration to initializing the SDK.

💡 Developer Tips

  • Always ensure you initialize the SDK before making any other SDK calls.
  • Verify all cryptographic parameters (cipherSpec, cipherSalt) follow the expected format.
  • For production, use RDNA_NO_LOGS to disable verbose logging.
  • If using proxy or SSL certificates, validate configurations and storage security.

⚙️ Cordova
com.uniken.rdnaplugin.RdnaClient.initialize(
  initSuccess,
  initFailure,
  [
    AGENT_INFO,
    HOST,
    PORT,
    CIPHERSPECS,
    CIPHER_SALT,
    PROXY_SETTINGS,
    RDNASSLCertificate,
		com.uniken.rdnaplugin.RdnaClient.RDNALoggingLevel.RDNA_NO_LOGS,
  		InitOptions
  ]
);
ParameterTypeDescription
initSuccessFunctionSuccess callback.
initFailureFunctionFailure callback.
AGENT_INFOStringAgent info for session setup.
HOSTStringGateway IP/hostname.
PORTNumberGateway port.
CIPHERSPECSStringFormat: "AES/256/CFB/NoPadding:SHA-256"
CIPHER_SALTStringSalt string.
PROXY_SETTINGSJSONOptional proxy config.
RDNASSLCertificateObjectOptional SSL cert object.
RDNALoggingLevelEnumSDK logging level.
InitOptionsJSON StringConfiguration to initializing the SDK.

💡 Developer Tips

  • Always ensure you initialize the SDK before making any other SDK calls.
  • Verify all cryptographic parameters (cipherSpec, cipherSalt) follow the expected format.
  • For production, use RDNA_NO_LOGS to disable verbose logging.
  • If using proxy or SSL certificates, validate configurations and storage security.

🍎 Native iOS (Objective-C)
-(RDNAError *)initialize:(NSString *)agentInfo
               Callbacks:(id<SomeCallbackProtocol>)callbacks
            GatewayHost:(NSString *)authGatewayHNIP
            GatewayPort:(uint16_t)authGatewayPORT
             CipherSpec:(NSString *)cipherSpec
             CipherSalt:(NSString *)cipherSalt
         ProxySettings:(RDNAProxySettings *_Nullable)proxySettings
  RDNASSLCertificate:(RDNASSLCertificate *_Nullable)rdnaSSLCertificate
        DNSServerList:(NSArray<NSString*> *_Nullable)dnsServerList
        RDNALoggingLevel:(RDNALoggingLevel)loggingLevel
             InitOptions:(NSString *)InitOptions
           AppContext:(id)appCtx;
ParameterTypeDescription
agentInfoStringIdentity for backend session.
callbacksObjectCallback implementation.
authGatewayHNIPStringGateway server hostname/IP.
authGatewayPORTintGateway port.
cipherSpecStringEncryption format string.
cipherSaltStringSalt string.
proxySettingsObjectOptional proxy info.
rdnaSSLCertificateObjectOptional cert info.
dnsServerListArrayOptional DNS server list.
loggingLevelEnumSDK log level.
InitOptionsStringConfiguration to initializing the SDK.
appCtxObjectApplication context.

💡 Developer Tips

  • Always ensure you initialize the SDK before making any other SDK calls.
  • Verify all cryptographic parameters (cipherSpec, cipherSalt) follow the expected format.
  • For production, use RDNA_NO_LOGS to disable verbose logging.
  • If using proxy or SSL certificates, validate configurations and storage security.

🤖 Native Android
RDNA.RDNAError Initialize(
  String agentInfo,
  RDNACallbacks rdnaCallbacks,
  String authGatewayHNIP,
  int authGatewayPORT,
  String cipherSpecs,
  String cipherSalt,
  RDNAProxySettings proxySettings,
  RDNASSLCertificate sslCertificate,
  String[] dnsServer,
RDNALoggingLevel loggingLevel,
 String InitOptions,
  Object appCtx
);
ParameterTypeDescription
agentInfoStringBackend session agent info.
rdnaCallbacksObjectCallback implementation.
authGatewayHNIPStringGateway IP/host.
authGatewayPORTintGateway port.
cipherSpecsStringEncryption string.
cipherSaltStringSalt string.
proxySettingsObjectOptional proxy config.
sslCertificateObjectOptional SSL info.
dnsServerArrayOptional DNS array.
loggingLevelEnumSDK logging level.
InitOptionsJSON StringConfiguration to initializing the SDK.
appCtxObjectAndroid app context.

💡 Developer Tips

  • Always ensure you initialize the SDK before making any other SDK calls.
  • Verify all cryptographic parameters (cipherSpec, cipherSalt) follow the expected format.
  • For production, use RDNA_NO_LOGS to disable verbose logging.
  • If using proxy or SSL certificates, validate configurations and storage security.

'InitOptions' Parameter Structure

The initOptions is a JSON string that gets parsed and contains configuration for initializing the Ditto SDK. here's the structure:

Sample JSON (Default)

{
    "permissionOptions": {
      "isLocationPermissionRequired": true,
      "isLocationPermissionMandatory": false
    },
    "languageOptions": {
      "localeCode": "en_US",
      "localeName": "English",
      "languageDirection": 0  // 0 = LTR (Left-to-Right), 1 = RTL (Right-to-Left)
    },
    "otelConfig": {
      "disableTrace": 0,
      "otelTraceFlushTimeout": 5000,
      "enableEncoding": "",
      "otelHTTPEndpointURL": ""
    }
  }

Key Details

FieldTypePurpose
permissionOptions.isLocationPermissionRequiredbooleanWhether location permission is needed
permissionOptions.isLocationPermissionMandatorybooleanWhether location permission is mandatory for app functionality
languageOptions.localeCodestringLanguage locale code (e.g., "en_US", "fr_FR")
languageOptions.localeNamestringHuman-readable language name
languageOptions.languageDirectionnumber0 = LTR, 1 = RTL for RTL languages
otelConfig.disableTracenumberDisable OpenTelemetry tracing
otelConfig.otelTraceFlushTimeoutnumberTimeout for flushing traces
otelConfig.enableEncodingstringEncoding type (e.g., "gzip", "deflate")
otelConfig.otelHTTPEndpointURLstringOpenTelemetry HTTP endpoint URL

Sample Code

const InitOptions = JSON.stringify({
    permissionOptions: {
      isLocationPermissionRequired: true,
      isLocationPermissionMandatory: false
    },
    languageOptions: {
      localeCode: "en_US",
      localeName: "English",
      languageDirection: 0  // LTR
    },
    otelConfig: {
      disableTrace: 0,
      otelTraceFlushTimeout: 5000,
      enableEncoding: "",
      otelHTTPEndpointURL: ""
    }
  });

📘 SDK Error Codes and Handling for Initialization

This section documents specific error codes that may occur during the Initialize API call and the recommended developer action.

🔹 Error Code: 88

  • Enum: RDNA_ERR_RDNA_ALREADY_INITIALIZED
  • Event/API: Initialize(Sync)
  • Action: Terminate the SDK to avoid re-initialization. This helps during development and prevents errors during React Native code refresh.

🔹 Error Code: 179

  • Enum: RDNA_ERR_INITIALIZE_ALREADY_IN_PROGRESS
  • Event/API: Initialize(Sync)
  • Action: Avoid invoking the Initialize API again while initialization is already in progress. Wait for the current initialization to complete.

🔹 Error Code: 218

  • Enum: RDNA_ERR_DEVICE_SECURITY_CHECKS_FAILED_FRIDA_MODULES_DETECTED
  • Event/API: Initialize(Sync)
  • Action: The SDK detected a Frida attack. This is triggered when:
    • Connection profile has MTD enabled, and
    • “Device Threat” category has “App Tampering” detection set to Terminate or Report.