Data Signing

✍️ What is Data Signing?

Data signing is a cryptographic process that ensures a piece of data (e.g., a transaction or message) is securely associated with the authenticated user. It guarantees:

  • Authenticity – the user authorized the action.
  • Integrity – the data was not tampered with.

REL-ID SDK provides this feature using secure local authentication (biometric/PIN/password) before signing sensitive payloads.


⚙️ How Does It Work?

  1. The mobile app initiates a signing request using the authenticateUserAndSignData() API.
  2. SDK prompts the user for authentication based on parameters like authLevel and authenticatorType.
  3. Upon successful authentication, the SDK signs the payload.
  4. SDK emits the event onAuthenticateUserAndSignData with the result.
  5. App processes the response and proceeds accordingly.
  6. If needed, app may call ResetAuthenticateUserAndSignDataState() to clear cached signing state.

🧾 Overview

These APIs facilitate secure user authentication and payload signing, used in workflows like transaction approvals or consent validations.


📲 UI Screen Requirements

The app must:

  • Display biometric prompt for authentication
  • Clearly state the operation being signed (e.g., "Sign transaction")
  • Show confirmation on success
  • Handle retry on failure

🔐 1. AuthenticateUserAndSignData API

📘 Purpose

Initiates step-up authentication and data signing.

🔧 Parameters

ParameterTypeRequiredDescription
payloadString✅ YesJSON to be signed
authLevelInt✅ YesMust be 4 for step-up biometric authentication
authenticatorTypeInt❌ OptionalMust be 1 (IDVServerBiometric) if specified
reasonString❌ OptionalDescribes why the signing is being performed

🔐 Controlling Authentication

📊 authLevel Values

ValueNameDescription
0No AuthenticationNo user authentication is required.
1Re-AuthenticationReuses initial login method (LDA, device PIN, etc.).
2⚠️ Not SupportedSDK throws an error if this is used.
3Manual PasswordRequires REL-ID password only.
4Step-up AuthenticationRequires strong biometric via IDVServerBiometric.
🧠

What isIDVServerBiometric?
IDVServerBiometric refers to biometric authentication that is registered with and validated by the IDV server. It ensures that the biometric used (e.g., fingerprint, face, palm) is:

  • Enrolled and linked to the user on the server,
  • Verified locally on device,
  • And approved by the server as part of step-up authentication.

🧩 authenticatorType (Only valid value: 1)

ValueDescription
1IDVServerBiometric only
🔒

Only value 1 is valid for data signing. All others are unsupported and should not be used.


💡 Sample Request

{
  "payload": "{"txnId":"TXN123456","amount":10000}",
  "authLevel": 4,
  "authenticatorType": 1,
  "reason": "Compliance biometric verification"
}

📥 Code Snippets

React Native
RdnaClient.authenticateUserAndSignData(
payload,
4,
1,
"Authorizing high-value payment"
);
Flutter
rdna.authenticateUserAndSignData(
  payload,
  authLevel: 4,
  authenticatorType: 1,
  reason: "Authorizing high-value payment"
);
Cordova
com.uniken.rdnaplugin.RdnaClient.authenticateUserAndSignData(
  payload,
  4,
  1,
  "Authorizing high-value payment"
);
Native iOS (Objective-C)
NSString *payload = @"{"transactionId":"TX456","amount":2000}";
NSInteger authLevel = 4;
NSInteger authenticatorType = 1;
NSString *reason = @"Authorizing high-value payment";

[[RDNAClient sharedInstance] authenticateUserAndSignData:payload
                             authLevel:authLevel
                             authenticatorType:authenticatorType
                             reason:reason];
Native Android (Java)
String payload = "{\"transactionId\":\"TX456\",\"amount\":2000}";
int authLevel = 4;
int authenticatorType = 1;
String reason = "Authorizing high-value payment";

RdnaClient.getInstance().authenticateUserAndSignData(
  payload,
  authLevel,
  authenticatorType,
  reason
);

📡 2. onAuthenticateUserAndSignData (Event)

📘 Purpose

Callback event triggered after authenticateUserAndSignData() is called. Provides result.

🧾 Sample Payload

{
  "userID": "john_doe",
  "payload": "{signed_data}",
  "status": {
    "statusCode": 100,
    "statusMessage": "Signed successfully"
  },
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  }
}

🔄 3. ResetAuthenticateUserAndSignDataState API

📘 Purpose

Resets the cached state of a prior data signing operation. If any error occurs or the user wants to cancel or reset the flow, resetAuthenticateUserAndSignDataState needs to be called to acknowledge the SDK that the user is re-starting the sign data flow.

📥 Code Snippets

React Native
RdnaClient.resetAuthenticateUserAndSignDataState();
Flutter
rdna.resetAuthenticateUserAndSignDataState();
Cordova
com.uniken.rdnaplugin.RdnaClient.resetAuthenticateUserAndSignDataState();
iOS
- (void)resetAuthenticateUserAndSignDataState;
Android
void resetAuthenticateUserAndSignDataState();

⚠️ Error Codes

CodeMeaningAction Required
100SuccessProceed
400Malformed/Invalid PayloadRetry or validate data
500Authentication failedRe-prompt for biometrics
600Biometric not enrolledRedirect user to enroll

✅ Developer Responsibilities

ConditionAction
Success (100)Confirm and continue flow
Failure (400–600)Show error, retry or re-enroll biometric