Skip to content

Conversation

@abhix2112
Copy link
Contributor

SmartAadhaar - ServiceNow Integration Script Include

A production-ready ServiceNow Script Include for Aadhaar verification and eKYC, utilizing a Connection & Credential Alias for secure, secret-free integration.

⚠️ Compliance Warning: Adherence to UIDAI regulations, the IT Act, DPDP, and your provider's terms is mandatory. Always obtain explicit user consent before performing any verification.


🎯 Key Features

This script provides a complete flow for secure Aadhaar integration:

Feature Methods Description
OTP eKYC Flow sendOtp(), verifyOtp() Multi-step process with built-in session management (expiry, replay protection).
Demographic Check verifyDemographic() Verify identity (Name, DOB, Gender) without OTP. Returns a match score.
Document Retrieval getDocument() Downloads Aadhaar XML/PDF (supports encrypted documents).
Status Tracking checkStatus() Queries the status of any ongoing verification session.

🔒 Security & Compliance Built-in

  • No Hardcoded Secrets: Uses Connection & Credential Alias (aadhaar_api).
  • Data Masking: Hides Aadhaar/mobile numbers in logs (e.g., XXXX-XXXX-1234).
  • Audit Logging: Comprehensive logging of purpose, actor, consent, and outcome.
  • Consent Tracking: Persistent tracking of the user's consent statement and timestamp.

🛠️ Setup & Configuration

  1. Create Connection & Credential Alias:

    • Name: aadhaar_api (or your chosen alias).
    • Base URL: Your provider's base endpoint (https://api.provider.tld).
    • Auth: Configure credentials (API Key, OAuth, Basic) as per your provider.
  2. Configure Endpoints (In Script): Map your provider's API paths inside the Script Include:

    var endpoints = {
      otpSend: "/aadhaar/otp/send",
      otpVerify: "/aadhaar/otp/verify",
      // ... and others
    };
  3. Set Timeouts & Retries: Configure timeoutMs (default 8000) and retries (default 2) to manage reliability.


🚀 Usage Examples

Use from a Background Script or any server-side logic:

var sa = new SmartAadhaar();

// 1. Send OTP & Get Session ID
var s1 = sa.sendOtp({
  uid: "123412341234",
  purpose: "eKYC for onboarding",
  consent: true,
});

// 2. Verify OTP (using session_id from s1)
var s2 = sa.verifyOtp({
  uid: "123412341234",
  otp: "123456",
  session_id: s1.data.session_id,
});
if (s2.ok) {
  gs.info("eKYC success for: " + s2.data.name);
}

API Reference

All methods return a normalized envelope:
{ ok:Boolean, code:Number, message:String, data:Object }

Method Purpose Required Parameters
sendOtp(p) Initiate OTP flow uid, purpose, consent
verifyOtp(p) Verify OTP and fetch eKYC uid, otp, session_id
verifyDemographic(p) Demographic match w/o OTP uid, name, dob, gender

@github-actions
Copy link

Thank you for your contribution. However, it doesn't comply with our contributing guidelines.

As a reminder, the general requirements (as outlined in the CONTRIBUTING.md file) are the following: follow the folder+subfolder guidelines and include a README.md file explaining what the code snippet does.

Validation errors:

Folder structure violations found:
 - Move 'Integration/adhaar Verification/redme.md' under a valid folder hierarchy (Category/Subcategory/Use-Case/your-file). Files directly inside 'Integration' or its subcategories are not allowed.
 - Move 'Integration/adhaar Verification/script.js' under a valid folder hierarchy (Category/Subcategory/Use-Case/your-file). Files directly inside 'Integration' or its subcategories are not allowed.

Review your contribution against the guidelines and make the necessary adjustments. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.

@github-actions github-actions bot closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant