addNewDeviceOptions

🧭 Overview

The addNewDeviceOptions event is triggered when a user attempts to log in from a new device. It is part of the additional device activation flow. The event provides the developer with information on how the device can be authenticated, such as via Ditto Verify Notification.

šŸŽÆ Purpose

  • To prompt the developer to show a screen informing the user about device activation.
  • To give the user a way to approve or deny device activation.
  • If approved, call performVerifyAuth(true) to complete the activation.
  • If denied, call performVerifyAuth(false) or fallback using fallbackNewDeviceActivationFlow().

šŸ–„ļø UI Screen Requirements

Present a screen showing:

  • šŸ“± Device activation method: "REL-ID Verify Authentication".
  • šŸ›”ļø Description and response label (from challengeInfo).
  • āœ… "Yes, activate this device" → call performVerifyAuth(true)
  • āŒ "No, do not activate" → call performVerifyAuth(false) or fallbackNewDeviceActivationFlow()

šŸ“© Sample Event Payload

{
  "userID": "testuser",
  "newDeviceOptions": ["REL-ID Verify Authentication"],
  "challengeInfo": [
    {
      "key": "Response label",
      "value": "REL-ID Verify notification will be sent on all your registered device(s). Approve it to activate this device."
    },
    {
      "key": "description",
      "value": "You will have to provide additional authentication data registered with Enterprise to activate this device."
    },
    { "key": "SDK_CHLNG", "value": "NO" },
    { "key": "SDK_CHLNG_MODE", "value": "NA" },
    { "key": "AUTO_ANSWER", "value": "true" }
  ]
}

šŸ’» Code Snippets

React Native
let addNewDeviceOptionsSubscription = rdnaEventRegistery.addListener(
  'addNewDeviceOptions',
  this.addNewDeviceOptions.bind(this)
);
RdnaClient.performVerifyAuth(true, (syncResponse) => {
  console.log("Device activation approved.");
});
Flutter
rdnaClient.on(RdnaClient.addNewDeviceOptions, (response) {
  print("Device activation option:", response);
});

rdnaClient.performVerifyAuth(true);
Cordova
document.addEventListener('addNewDeviceOptions', function(event) {
  console.log("Received device auth event:", event);
});

com.uniken.rdnaplugin.RdnaClient.performVerifyAuth(
  () => console.log("Approved"),
  (err) => console.error("Error", err),
  [true]
);
Native Android
void addNewDeviceOptions(String userID, String[] arrOfOptions, HashMap<String, String> info) {
    // Show UI with challengeInfo data
}
RDNAError error = rdna.performVerifyAuth(true);
Native iOS
- (void)addNewDeviceOptions:(NSString *)userID options:(NSArray<NSString *> *)options info:(NSArray<RDNAChallengeInfo *> *)info {
    // Show UI with options and info content
}
[client performVerifyAuth:YES];

ā— Error Handling