setSecretQuestionAnswer

šŸ” setSecretQuestionAnswer API

The setSecretQuestionAnswer API is used to submit secret question-answer pairs in response to the onSelectSecretQuestionAnswer event and the getSecretAnswer event. This supports one or multiple questions depending on the value of numberOfQuestionsToSet.


šŸ“„ Required Parameters

ParameterDescription
questionAndAnswerArray of objects with question and answer keys
challengeModeMode of the challenge, must be passed from the event's payload
syncResponse (callback)Callback invoked after submission (React Native/Cordova)

šŸ“± Platform-specific Usage

šŸ’™ React Native
const qaPairs = [
  { question: "What is your nickname?", answer: "Jonny" },
  { question: "What is your dream job?", answer: "Astronaut" }
];

RdnaClient.setSecretQuestionAnswer(
  JSON.stringify(qaPairs),
  1, // challengeMode
  (response) => {
    console.log("Secret answers submitted:", response);
  }
);
🟣 Flutter
List<RDNASecretQuestionAndAnswer> qaPairs = [
  RDNASecretQuestionAndAnswer("What is your nickname?", "Jonny"),
  RDNASecretQuestionAndAnswer("What is your dream job?", "Astronaut"),
];

rdnaClient.setSecretQuestionAnswer(qaPairs, 1); // 1 = challengeMode
🧩 Cordova
const questionAnswerList = [
  { question: "What is your nickname?", answer: "Jonny" },
  { question: "What is your dream job?", answer: "Astronaut" }
];

com.uniken.rdnaplugin.RdnaClient.setSecretQuestionAnswer(
  () => console.log("Success"),
  (err) => console.error("Error", err),
  [JSON.stringify(questionAnswerList), 1]
);
šŸ iOS (Objective-C)
RDNASecretQuestionAndAnswer *qa1 = [[RDNASecretQuestionAndAnswer alloc] initWithQuestion:@"What is your nickname?" answer:@"Jonny"];
RDNASecretQuestionAndAnswer *qa2 = [[RDNASecretQuestionAndAnswer alloc] initWithQuestion:@"What is your dream job?" answer:@"Astronaut"];

NSArray *qaArray = @[qa1, qa2];
[rdnaInstance setSecretQuestionAnswer:qaArray challengeMode:1];
šŸ¤– Android (Java)
RDNASecretQuestionAnswer qa1 = new RDNASecretQuestionAnswer("What is your nickname?", "Jonny");
RDNASecretQuestionAnswer qa2 = new RDNASecretQuestionAnswer("What is your dream job?", "Astronaut");

RDNASecretQuestionAnswer[] qaArray = new RDNASecretQuestionAnswer[] { qa1, qa2 };
rdna.setSecretQuestionAnswer(qaArray, RDNAChallengeOpMode.MANUAL);

āŒ Error Scenarios

Status Code / Error CodeDescriptionBehavior
106Invalid secret answerSDK re-triggers getSecretQuestion if attemptsLeft > 0
110Challenge expiredChallenge fails and next workflow step is invoked
153Attempts exhaustedSDK ends challenge, decides next event (e.g., lockout)
113 / 150Internal errorHandle gracefully and suggest retry

Use status.statusCode, error.shortErrorCode, and error.errorString to implement user-friendly error handling.


🧠 Behavior Summary

  • āœ… Correct Answer: Challenge completes and next event is triggered.
  • āŒ Incorrect Answer:
    • If attempts remain → same challenge is shown again.
    • If no attempts → SDK moves on based on workflow.

🧠 Notes

  • Always pass the samechallengeMode received inonSelectSecretQuestionAnswer or getSecretAnswer event.
  • Validate answers for length and input policy before submission.
  • This API may be required only once per user setup (typically during onboarding or activation).