Get Device ID

šŸ“± Ditto ID SDK API Documentation: getDeviceID

šŸ“˜ Overview

The getDeviceID API provides a unique identifier for the device on which the SDK is currently running. This device ID is useful for device-level authentication, session tracking, and encryption scope.

šŸŽÆ Purpose

Use this API to:

  • Retrieve a consistent and unique identifier for the device.
  • Tie authentication tokens or cryptographic operations to a specific device.
  • Enable device-level tracking, audit logging, or access control.

šŸ” API Flow

  1. Ensure the SDK is initialized.
  2. Call getDeviceID().
  3. Use the returned device ID string where needed.

🧾 Response

Returns the device ID as a String value.

šŸ”§ Example Response:

{
  "response": "2JUW5N1Z92XK3CSJY3QWB26IY2W5AV529DICH6C12SD7W245U2",
  "error": {
    "shortErrorCode": 0,
    "longErrorCode": 0,
    "errorString": "Success"
  }
}

šŸ’» Code Snippets

React Native
RdnaClient.getDeviceID((response) => {
  const deviceId = response.response;
});
Flutter
final deviceId = await rdnaClient.getDeviceID();
Cordova
com.uniken.rdnaplugin.RdnaClient.getDeviceID(successCallback, errorCallback);
Native iOS
NSString* deviceId = [rdnaClient getDeviceID];
Native Android
String deviceId = rdnaClient.getDeviceID();

āš ļø Error Codes

CodeErrorAction
0SuccessUse the returned value
4RDNA_ERR_INVALID_ARGSEnsure SDK is initialized
88RDNA_ERR_RDNA_ALREADY_INITIALIZEDTypically safe, may ignore

🧠 Developer Notes

  • The device ID is tied to the device and should remain consistent unless the app or device is reset.
  • For cryptographic operations, pair with privacyScope = DEVICE.
  • Should not be confused with session ID or user ID.

šŸ“„ End of Documentation