93 lines
5.3 KiB
Python
93 lines
5.3 KiB
Python
OTP_TEMPLATES = (
|
|
{
|
|
"type": "general_verification",
|
|
"name": "URMI General Verification OTP",
|
|
"content": "Your URMI verification code for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI verification code for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": [
|
|
"Phone or email verification", "Signup and registration", "KYC or identity verification",
|
|
"Invitation acceptance", "General verification",
|
|
],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "login_authentication",
|
|
"name": "URMI Login Authentication OTP",
|
|
"content": "Your URMI login verification code for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI login verification code for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Normal or passwordless login", "MFA and 2FA", "Admin login", "Authentication"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "account_recovery",
|
|
"name": "URMI Account Recovery OTP",
|
|
"content": "Your URMI account recovery code for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI account recovery code for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Forgot password", "Password reset", "Account or locked-account recovery"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "account_change",
|
|
"name": "URMI Account Change OTP",
|
|
"content": "Your URMI verification code to update your account for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI verification code to update your account for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Change mobile number or email", "Change password", "MFA or security setting changes"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "action_authorization",
|
|
"name": "URMI Action Authorization OTP",
|
|
"content": "Your URMI authorization code for this action on {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI authorization code for this action on {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Sensitive or high-risk operations", "API key changes", "Account deletion", "Ownership changes"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "transaction_verification",
|
|
"name": "URMI Transaction Verification OTP",
|
|
"content": "Your URMI transaction verification code for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI transaction verification code for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Payment authorization", "Transfers and withdrawals", "Financial transaction confirmation"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
{
|
|
"type": "device_verification",
|
|
"name": "URMI Device Verification OTP",
|
|
"content": "Your URMI device verification code for {message_label} is {#var#}. It is valid for {#var#} minutes. - URMI",
|
|
"sample": "Your URMI device verification code for {message_label} is 583921. It is valid for 10 minutes. - URMI",
|
|
"uses": ["Device registration or pairing", "Device activation", "IoT ownership verification", "Device transfer"],
|
|
"variables": ["Product identification ({message_label})", "OTP ({#var#})", "Validity duration in minutes ({#var#})"],
|
|
},
|
|
)
|
|
|
|
|
|
def render_templates_for_project(message_label: str) -> list[dict]:
|
|
rendered: list[dict] = []
|
|
for template in OTP_TEMPLATES:
|
|
rendered.append(
|
|
{
|
|
**template,
|
|
"content": template["content"].replace("{message_label}", message_label),
|
|
"sample": template["sample"].replace("{message_label}", message_label),
|
|
}
|
|
)
|
|
return rendered
|
|
|
|
|
|
OTP_API_DOCUMENTATION = {
|
|
"method": "POST",
|
|
"path": "/api/v1/otp/generate",
|
|
"implemented": True,
|
|
"summary": "Generate and deliver an OTP using one of Urmi's unified verification templates.",
|
|
"parameters": {
|
|
"project_name": "Your approved UrmiOTP project name.",
|
|
"template_type": "One of the supported template type identifiers.",
|
|
"variables": "Values for OTP and validity duration ({#var#} placeholders), in template order.",
|
|
"message_label": "Registered with your project; fills the {message_label} slot as your product identification. URMI branding stays fixed.",
|
|
},
|
|
"example": {
|
|
"project_name": "acme-login",
|
|
"template_type": "login_authentication",
|
|
"variables": {"otp": "583921", "validity_minutes": "10"},
|
|
},
|
|
}
|