initialize
⚙️ initialize() Method
initialize() MethodThe 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()
initialize()| Event | Description |
|---|---|
onInitializeProgress | Tracks progress (e.g., threat checks, server connection). Includes statuses like STARTED, COMPLETED, INIT_FAILED. |
onInitializeError | Reports errors during initialization (e.g., invalid parameters, network issues). |
onUserConsentThreats | Triggered if non-terminating threats are detected. App decides whether to proceed using takeActionOnThreats(). |
onTerminateWithThreats | Triggered for critical threats (configured to terminate). These are blocking issues. |
onInitialized | Indicates that initialization completed successfully. Returns session metadata and IDV configuration (if available). |
getUser | Triggered 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);
}
);
| Parameter | Type | Description |
|---|---|---|
currentAgentInfo | String | Software identity info for API-runtime authentication. |
currentGatewayHost | String | Hostname or IP of the gateway server. |
currentGatewayPort | Number | Port number of the gateway server. |
cipherSpecs | String | Format: "AES/256/CFB/NoPadding:SHA-256" |
cipherSalt | String | Recommended: <APPLICATION_PACKAGE_NAME> |
jsonProxySettings | String (JSON) | Optional proxy settings JSON. |
sslDetails | Object | Optional SSL details: base64 cert, password, enableSSL. |
RDNALoggingLevel | Enum | Enum for SDK log level. |
InitOptions | String (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_LOGSto 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?,
);| Parameter | Type | Description |
|---|---|---|
AGENT_INFO | String | Software identity string. |
HOST | String | Gateway server IP or hostname. |
PORT | int | Gateway port. |
CIPHERSPECS | String | Cipher config string. |
CIPHER_SALT | String | Recommended: <APPLICATION_PACKAGE_NAME> |
PROXY_SETTINGS | JSON String | Optional proxy info. |
RDNASSLCertificate | JSON Object | Optional: base64 cert, password, enableSSL. |
RDNALoggingLevel | Enum | Controls logging level. |
InitOptions | JSON String | 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_LOGSto 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
]
);| Parameter | Type | Description |
|---|---|---|
initSuccess | Function | Success callback. |
initFailure | Function | Failure callback. |
AGENT_INFO | String | Agent info for session setup. |
HOST | String | Gateway IP/hostname. |
PORT | Number | Gateway port. |
CIPHERSPECS | String | Format: "AES/256/CFB/NoPadding:SHA-256" |
CIPHER_SALT | String | Salt string. |
PROXY_SETTINGS | JSON | Optional proxy config. |
RDNASSLCertificate | Object | Optional SSL cert object. |
RDNALoggingLevel | Enum | SDK logging level. |
InitOptions | JSON String | 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_LOGSto 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;| Parameter | Type | Description |
|---|---|---|
agentInfo | String | Identity for backend session. |
callbacks | Object | Callback implementation. |
authGatewayHNIP | String | Gateway server hostname/IP. |
authGatewayPORT | int | Gateway port. |
cipherSpec | String | Encryption format string. |
cipherSalt | String | Salt string. |
proxySettings | Object | Optional proxy info. |
rdnaSSLCertificate | Object | Optional cert info. |
dnsServerList | Array | Optional DNS server list. |
loggingLevel | Enum | SDK log level. |
InitOptions | String | Configuration to initializing the SDK. |
appCtx | Object | Application 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_LOGSto 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
);| Parameter | Type | Description |
|---|---|---|
agentInfo | String | Backend session agent info. |
rdnaCallbacks | Object | Callback implementation. |
authGatewayHNIP | String | Gateway IP/host. |
authGatewayPORT | int | Gateway port. |
cipherSpecs | String | Encryption string. |
cipherSalt | String | Salt string. |
proxySettings | Object | Optional proxy config. |
sslCertificate | Object | Optional SSL info. |
dnsServer | Array | Optional DNS array. |
loggingLevel | Enum | SDK logging level. |
InitOptions | JSON String | Configuration to initializing the SDK. |
appCtx | Object | Android 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_LOGSto 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
| Field | Type | Purpose |
|---|---|---|
| permissionOptions.isLocationPermissionRequired | boolean | Whether location permission is needed |
| permissionOptions.isLocationPermissionMandatory | boolean | Whether location permission is mandatory for app functionality |
| languageOptions.localeCode | string | Language locale code (e.g., "en_US", "fr_FR") |
| languageOptions.localeName | string | Human-readable language name |
| languageOptions.languageDirection | number | 0 = LTR, 1 = RTL for RTL languages |
| otelConfig.disableTrace | number | Disable OpenTelemetry tracing |
| otelConfig.otelTraceFlushTimeout | number | Timeout for flushing traces |
| otelConfig.enableEncoding | string | Encoding type (e.g., "gzip", "deflate") |
| otelConfig.otelHTTPEndpointURL | string | OpenTelemetry 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.
Updated 2 months ago
