getTOTPPassword

🔐 REL-ID SDK: getTOTPPassword Event and setTOTPPassword API

This document provides a complete reference for handling password-based TOTP generation in the REL-ID SDK.


🔁 Event: getTOTPPassword

🧭 Overview

Triggered when the SDK requires the user's password to proceed with generating a TOTP. This typically happens in offline or fallback authentication scenarios when LDA (e.g., fingerprint or pattern) is not available.


🔐 Conditions for triggering getTOTPPassword

getTOTPPassword may still be triggered by the SDK when:

  • LDA is not available or disabled
  • SDK policy requires password confirmation before TOTP generation
  • Offline mode is enabled and cached password fallback is required

🧾 UI Guidelines

  • Display a clear message like:

    “Please enter your REL-ID password to generate your one-time password (TOTP).”

  • Use masked input for the password field.
  • Clearly indicate the number of attempts remaining if attemptsLeft is provided.

📦 Sample Payload

{
  "userID": "ad3",
  "challengeMode": 0,
  "attemptsLeft": 3,
  "challengeResponse": {},
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  }
}

📥 Payload Fields

FieldTypeDescription
userIDStringUser ID of the session
challengeModeIntChallenge mode enum (typically 0 = verify)
attemptsLeftIntNumber of attempts remaining
challengeResponseObjectContains challenge info, password policy, etc.
errorObjectError status info (code, message)

💻 Platform Handling

React Native
let getTOTPPasswordSubscription = rdnaEventRegistery.addListener(
  'getTOTPPassword',
  this.getTOTPPassword.bind(this)
);
Flutter
rdnaClient.on(RdnaClient.getTOTPPassword, (response) {
  print("Password required for TOTP: ${response.userID}");
});
Cordova
document.addEventListener('getTOTPPassword', function(e) {
  console.log("Prompt password input for:", e.userID);
});
iOS (Objective-C)
(void)getTOTPPassword:(NSString *)userID
       challengeMode:(RDNAChallengeOpMode)mode
        attemptsLeft:(int)attemptsLeft
             response:(RDNAChallengeResponse *)response
                error:(RDNAError *)error;
Android
void getTOTPPassword(String userID, int challengeMode, int attemptsLeft,
    RDNAChallengeResponse challengeResponse, RDNAError error);

🛠️ API: setTOTPPassword

🧭 Overview

Used to submit the password provided by the user in response to the getTOTPPassword event. Upon validation, the SDK proceeds to generate the TOTP.

📥 Parameters

ParameterTypeRequiredDescription
passwordStringUser-entered password

💻 Platform Usage

React Native
RdnaClient.setTOTPPassword("userEnteredPassword", (response) => {
  console.log("TOTP password response:", response);
});
Flutter
await rdnaClient.setTOTPPassword("userPassword123");
Cordova
com.uniken.rdnaplugin.RdnaClient.setTOTPPassword(
  () => console.log("Password submitted"),
  (err) => console.error("Password error", err),
  ["userPassword123"]
);
iOS (Objective-C)
[client setTOTPPassword:@"userPassword123"];
Android
rdnaClient.setTOTPPassword("userPassword123");

✅ On Success

  • Password is validated.
  • SDK proceeds to generate TOTP → onTOTPGenerated event.

❌ On Failure

  • App should show retry prompt or fallback to other method if available.
  • Check attemptsLeft field from getTOTPPassword event.

Error codes for getTOTPPassword


Error CodeError ConstantFunctionBehavior / Description
108RDNA_ERR_INVALID_TOTP_CREDENTIALgetTOTPPasswordShow an error and display the TOTP password verification dialog box again.
113RDNA_ERR_TOTP_GENERIC_ERRORgetTOTPPasswordShow a generic error message to the user.


🧠 Key Point

REL-ID treats TOTP generation as a sensitive action, often requiring user confirmation even after login, especially when no biometric (LDA) is in place.