OTP Controls

🔢 otp Controls – Configuration for OTP-Based Notifications

When the msg_type is set to "OTP" in the generateRVN API, the controls.otp section allows you to customize how the OTP (One-Time Password) is generated, secured, and validated.

This section defines the OTP's format, maximum entry attempts, and hashing mechanism.


⚙️ Sample Structure

"controls": {
  "otp": {
    "attempts": 3,
    "hash_spec": "sha256",
    "otp_spec": "N-6"
  }
}

🔍 Field Descriptions

FieldTypeDescription
attemptsinteger(Optional) Maximum allowed attempts for OTP entry. Default is 3.
hash_specstring(Optional) Algorithm to hash the generated OTP for storage. Default is Base64. Options include sha256, sha384, sha512, hex-sha256, etc.
otp_specstring(Optional) Defines the format and length of the OTP. Default is N-6.

🔐 otp_spec Formats

Each spec is a combination of a character set and length:

FormatCharacters UsedDescription
N-xNumbersNumeric OTP of length x
L-xLowercase lettersAlphabetic (lowercase) OTP
U-xUppercase lettersAlphabetic (uppercase) OTP
M-xMixed case lettersMixed uppercase/lowercase
LN-xLowercase + numbersAlphanumeric OTP
UN-xUppercase + numbersAlphanumeric OTP
MN-xMixed case + numbersStronger alphanumeric OTP

Where x is the OTP length (must be between 4 and 9).

⚠️

otp_spec defines the allowed characters but does not guarantee that each type of character appears in the final OTP.


🔐 hash_spec Options

ValueDescription
sha256OTP is hashed with SHA-256
sha384OTP is hashed with SHA-384
sha512OTP is hashed with SHA-512
hex-sha256Same as above but encoded in hex
(empty) or base64Default behavior – base64 encoded string

REL-ID server hashes the OTP before storing and compares using the same logic when validateOTP is called.


🧠 Best Practices

  • Set attempts based on security sensitivity (e.g., 3-5).
  • Use N-6 for standard numeric OTPs.
  • Prefer sha256 or stronger for hashing.
  • Handle OTP expiry using the main expires_in parameter.

📌

Use the otp section to tightly control how one-time passwords are created, hashed, and validated for secure transaction flows.