Customer documentation · Integration overview · Questions: contactus@diimeai.com

NonaShield SDK Integration Guide

For NonaShield SaaS customers. Your app talks to NonaShield at https://api.diimeai.com — use exactly this address on every platform.

What you need from NonaShield

ItemUsed in
SDK key (shown below as YOUR_SDK_KEY)Step "Start the SDK" on every platform
Android: android-sdk-release.aarAndroid steps
iOS: PayShieldKMP.xcframeworkiOS steps
React Native: the NonaShield React Native packageReact Native steps
Your app id(s), registered onceAndroid: the applicationId of your app (for example com.yourbank.mobile). iOS: the App ID TEAMID.bundle.id. Give them when you sign up, or add them in your dashboard under Apps. Add every variant you release (debug, test, Play Store, TestFlight, App Store)

The integration is the same four calls on every platform: start → register the device → connect your login → (optional) check before a payment or any other API. No amount or other payment data is ever passed.

Check the SDK file before you use it

Every Android SDK file comes with a checksum (.sha256) and a signature (.asc). Check both before you add the file to your app. The signing key is published at https://diimeai.com/docs/sdk-signing-key.asc; its fingerprint is 4275 43BF F32F 4A72 C041 4E43 6A6A 2722 27ED E4A2. Compare it with what gpg shows before you trust it.

curl -O https://diimeai.com/docs/sdk-signing-key.asc
gpg --import sdk-signing-key.asc
gpg --fingerprint 427543BFF32F4A72C0414E436A6A272227EDE4A2
sha256sum -c <the SDK file>.sha256
gpg --verify <the SDK file>.asc <the SDK file>

If either check fails, do not use the file and write to contactus@diimeai.com.

Your SDK key and your subscription

continues for a further 30 days.

sign-ins are refused with the error code SUBSCRIPTION_LAPSED. Your app is not otherwise affected. Pay the invoice or write to contactus@diimeai.com and access returns.

"SUBSCRIPTION_LAPSED" or "TENANT_KEY_INVALID", and null when all is well. A failed enrollment starts its reason with the same code. Use it to alert your own team, for example in your logs or monitoring. There is nothing for your users to do, and the SDK never blocks your app because of it: it stops calling NonaShield, keeps its events queued, and picks up again by itself once the key is accepted.

one. Put the new key in tenantId in your next app release. The old key keeps working until it expires, so there is no gap.


Android (Kotlin)

Requirements: minSdk 23+, compileSdk 34+, Kotlin Gradle plugin 2.1+, Java 17.

Step 1 — Add the SDK file. Copy android-sdk-release.aar into app/libs/.

Step 2 — Add it to Gradle. The SDK file is a plain .aar, so Gradle does not add the libraries it uses: add every line below, and the extra repository, or the build or the first run fails with a missing class. Two of the libraries (fingerprint-android and truetime-android) are published in Talsec's repository, so add it in settings.gradle (in dependencyResolutionManagement { repositories { ... } }):

maven {
    url 'https://europe-west3-maven.pkg.dev/talsec-artifact-repository/common'
    content {
        includeGroup 'com.github.fingerprintjs'
        includeGroup 'com.github.instacart'
    }
}

Then in app/build.gradle, inside dependencies { }, and click Sync Now:

implementation fileTree(dir: 'libs', include: ['*.aar'])
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
implementation 'com.google.android.play:integrity:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.biometric:biometric:1.1.0'
// The freeRASP runtime the SDK uses (the same versions the SDK file was built against):
implementation 'org.jetbrains.kotlin:kotlin-parcelize-runtime:2.0.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'com.android.tools.build:apksig:9.3.1'
implementation 'com.google.android.gms:play-services-base:18.10.0'
implementation 'com.github.fingerprintjs:fingerprint-android:2.2.0'
implementation 'com.github.instacart:truetime-android:4.0.0.alpha'

Step 3 — Allow internet. In AndroidManifest.xml, above <application:

<uses-permission android:name="android.permission.INTERNET" />

Step 4 — Start the SDK once, in your Application class onCreate() (register the class with android:name=".MyApplication" on <application> if you do not have one):

import android.util.Log
import com.payshield.sdk.PayShieldConfig
import com.payshield.sdk.PayShieldSDK
import com.payshield.sdk.SdkEnvironment
import com.payshield.sdk.enrollment.EnrollmentCallback
import com.payshield.sdk.enrollment.EnrollmentResult
import com.payshield.sdk.policy.PolicyDecision

PayShieldSDK.initialize(
    context = applicationContext,
    config  = PayShieldConfig(
        backendUrl        = "https://api.diimeai.com",
        tenantId          = "YOUR_SDK_KEY",
        autoBlockSeverity = null,
        environment       = SdkEnvironment.DEVELOPMENT,   // omit for your release build (PRODUCTION)
    ),
)

environment defaults to PRODUCTION; choose DEVELOPMENT explicitly for test builds only (the SDK logs a warning when it is active). A PRODUCTION config must include backendCertPins ("sha256/<base64>" pins for the NonaShield backend certificate, supplied by DIMEAI); without them PayShieldConfig throws IllegalArgumentException and the SDK does not start. The same applies on iOS and React Native.

Step 5 — Register the device, right after Step 4:

PayShieldSDK.enroll(callback = object : EnrollmentCallback {
    override fun onResult(result: EnrollmentResult) {
        when (result) {
            is EnrollmentResult.Success -> Log.i("NonaShield", "Enrollment OK")
            is EnrollmentResult.Failure -> Log.e("NonaShield", "Enrollment failed: ${result.reason}")
        }
    }
})

Step 6 — Connect your login. Where your own login succeeds:

PayShieldSDK.onUserLogin(userId = loggedInUserId)

Security findings on the device are reported from the moment enrollment succeeds, before anyone logs in; this call links the device to the user. To have NonaShield also check each login, see Protect any API of your app below and use the action name LOGIN.

When the user logs out, tell NonaShield. This ends the session at once on the device and on NonaShield, instead of when its token expires:

PayShieldSDK.onUserLogout()      // on every logout: the button, a session timeout, an account switch

The device stays enrolled and the next onUserLogin starts a new session. It is safe to call twice and safe to call from the main thread. Reports of security findings wait for the next login.

If your account with DIMEAI asks for the bank's proof of the login, pass it with the login. Your login service signs a short-lived, single-use token (RS256 or ES256, with a key whose public half you registered with DIMEAI) that names the user, and NonaShield binds the user to the device only when it verifies:

PayShieldSDK.onUserLogin(userId = loggedInUserId, loginAssertion = tokenFromYourLoginService)

It is sent once, with this login; the SDK's automatic token rotation does not send it again. If your account does not use this, keep the one-argument call above: nothing changes.

Step 7 — (Optional) Check before a payment. Call it from a coroutine, on every payment, just before you move any money. It waits for NonaShield's answer for this payment: a few seconds normally, or up to about a minute when your security team has to review a risky payment. The payment goes ahead only on ALLOW.

val check = try {
    PayShieldSDK.evaluatePaymentCheckpoint()
} catch (e: Exception) {
    null                                   // no answer: treat it as "not approved", never as success
}

when {
    check == null                              -> showRetry()           // could not verify; nothing was approved
    check.decision == PolicyDecision.ALLOW     -> continuePayment()
    check.decision == PolicyDecision.STEP_UP   -> startYourExtraCheck() // your OTP / biometric, then continue
    else                                       -> showBlocked(check.reason)
}

Protect any API of your app (the Critical API section)

NonaShield has no fixed list of critical APIs. You decide which of your APIs to protect, and the action name you pass to the check is that API's name. Every protected API follows the same flow. Call the check from a coroutine, just before you call your own API:

val check = try {
    PayShieldSDK.evaluateApiCheckpoint(action = "KYC")     // before your KYC-submit API
} catch (e: Exception) {
    null                                                   // no answer: not approved
}
// the same for any API: action = "OTP", "ADD_BENEFICIARY", "PAYMENT", or any name of your own
// for login: after your own login succeeds and you have called PayShieldSDK.onUserLogin(userId), and before
// you open the app, call it with the username the user typed:
//     PayShieldSDK.evaluateApiCheckpoint(action = "LOGIN", attemptedUserId = typedUsername)
// when the API adds or pays a beneficiary, also pass a stable reference to the payee from your own system
// (account number, VPA or your own id); only its SHA-256 leaves the phone, and NonaShield uses it to spot one
// payee being added by many accounts:
//     PayShieldSDK.evaluateApiCheckpoint(action = "ADD_BENEFICIARY", beneficiaryRef = payeeReference)
// enter the app only on ALLOW; on DENY, sign the user out again

Handle check exactly as in Step 7 and the next section. Your API is called only on ALLOW. evaluatePaymentCheckpoint() is the same call with the action PAYMENT, plus the payment-only options below.

The flow is the same for every API. If your account enforces on the device, the SDK blocks a call from a device with a critical issue, on the device. If it does not, a risky call is held for up to 60 seconds for your security team to allow, step up or block, and check carries that decision (a call nobody decides in time is denied). This wait happens only inside evaluateApiCheckpoint and evaluatePaymentCheckpoint, so call them only where you can wait. For an API where you only want a record and never a wait, use evaluateAtCheckpoint(action = "..."): it reports straight away, never makes your call wait, and the call still appears in the dashboard. Never use it to decide a payment: for "PAYMENT" it cannot wait for a verdict, so it always returns DENY with the reason live_verdict_required (a device or security-team block keeps its own reason). A payment goes ahead only through evaluatePaymentCheckpoint, on a live ALLOW or a security-team approval. This holds whether your account has "enforce on device" on or off.

Every call appears in one Critical API section of your NonaShield dashboard, with the action you passed in the Action column, the user, the device and what was decided (allowed, step-up, blocked, or held for review). That one section is how you see that your devices, your app and your APIs are all protected. An API whose action you never pass is not checked and does not appear. You do not have to protect every API: protect the ones you choose.

Rules for the action name: one stable name per API (the same name every time), capital letters, digits and _, up to 64 characters. SESSION is used by the SDK itself and is not shown.

What stays specific to payments: the transaction amount bucket and txCommitment (the payment step-up challenge), the new-device cooling period, and the location-consent rule below. All other APIs use the flow above without them.

Handle every outcome

Your app must handle all three decisions, for a payment and for any other API you protect (read "payment" below as "API call"). Nothing about the call (amount, recipient, note, message) is ever sent to NonaShield.

DecisionWhat your app does
ALLOWContinue the payment. Show success when your own payment call succeeds.
STEP_UPDo not continue yet. Run your own extra authentication (OTP, biometric or PIN). Continue only if it succeeds; otherwise stop. The extra check is yours to build; NonaShield only tells you it is needed.
DENYStop. Do not call your payment API. Show a message that fits check.reason (table below).

check.reason for a DENY:

check.reasonMeaningSuggested message
soc_blockedYour security team reviewed the payment and blocked it"This payment was blocked by security review. No money was moved."
soc_review_timeoutThe payment was held for review and was not approved in time"This payment was not approved in time. Please try again." Offer a retry.
verification_unavailableNonaShield could not be reached, so nothing was approved"We could not verify this payment. Check your connection and try again." Offer a retry.
critical_issue_enforcedA critical security issue was found on this device and your account enforces on the device"This payment was blocked because of a security issue on this device." Do not offer a retry.
on_device_persistent_blockThe SDK has blocked this deviceShow your blocked screen. Do not offer a retry.
backend_force_blockYour security team blocked this deviceShow your blocked screen. Do not offer a retry.
API_RISK_BLOCKNonaShield found a critical issue on this device or account and your account enforces on the device"This was blocked for security reasons." Do not offer a retry.
anything elseThe NonaShield decision for this callStop the call and show a general "blocked for security reasons" message.

check.reason for a STEP_UP:

check.reasonMeaning
soc_step_upYour security team reviewed the held payment and asked for extra authentication
consent_requiredThe customer declined location (see below), so a payment that would be approved needs extra authentication
anything elseNonaShield's own risk decision asked for extra authentication

Updating from an earlier SDK file: nothing changes unless you choose it. If you never call setTelephonyConsent and leave enableTelephonySignals at its default (true), the SDK behaves exactly as before. Use the latest SDK file from NonaShield to get these two settings.

SIM-swap, live-call and call-merge detection are among the strongest defences against OTP hijack and coached-payment fraud. Lending apps in particular should enable them with the customer's explicit consent: show your own notice (for example, "to protect your account from SIM-swap fraud, we check whether your SIM has changed") and report the answer:

PayShieldSDK.setTelephonyConsent(granted = true)    // the customer agrees; call it before initialize() at start-up
PayShieldSDK.setTelephonyConsent(granted = false)   // the customer declines or withdraws

Your app owns the notice, its wording and the record of the choice; the SDK holds the answer in memory only. SIM identity also needs the READ_PHONE_STATE permission, which your app declares and requests at the moment of consent. With granted = false, or by calling it with false at start-up until the customer has agreed, the SDK reads no SIM identity, SIM state or call state and raises none of these signals. Nothing else changes: hardware-key signing, attestation and every other check run as normal. Granting later resumes protection at the next evaluation.

Check with your own compliance team how paragraph 13(1) of the RBI NBFC Credit Facilities Directions 2025 applies to your app. If your policy is never to use telephony, set enableTelephonySignals = false in PayShieldConfig, which turns it off for the whole app. Location and behavioural data have their own switches: setLocationConsent(false) and enableBehavioral = false.

The same two settings exist on every platform:

PlatformReport the customer's choiceSwitch it off for the whole app
Android (Kotlin)PayShieldSDK.setTelephonyConsent(granted)PayShieldConfig(enableTelephonySignals = false)
iOS (Swift)PayShieldSDK.shared.setTelephonyConsent(granted: Bool)PayShieldConfig(..., enableTelephonySignals: false)
React NativePayShieldSdk.setTelephonyConsent(granted)initialize({ ..., enableTelephonySignals: false })
FlutterPayShieldSdk.setTelephonyConsent(granted)PayShieldSdk.initialize(..., enableTelephonySignals: false)
CordovaPayShieldSdk.setTelephonyConsent(granted)PayShieldSdk.initialize({ ..., enableTelephonySignals: false })

On iOS the same switch covers the concurrent-call, call-merge and cellular-service checks; there is no SIM identity to read. Call setTelephonyConsent at start-up before initialize, and again whenever the customer changes the choice.

When the customer declines location

NonaShield uses location only to check that a payment is plausible for the customer (for example, not made from two places too far apart to travel between). Your app owns the consent screen and its wording. Tell the SDK the answer:

PayShieldSDK.setLocationConsent(granted = false)   // the customer declined
PayShieldSDK.setLocationConsent(granted = true)    // the customer agrees, or changes their mind

Call it at start-up with the customer's saved choice, and again whenever they change it. The SDK keeps the answer in memory only.

What you tell the SDKWhat happens
falseThe SDK reads no location. A payment that would be approved returns STEP_UP with reason consent_required, so your app runs its own OTP or biometric. A payment that is blocked or held stays so; a refusal never softens a decision.
true, or you never call itUnchanged. The SDK reads a recent location fix only when your own app already holds the location permission. The SDK never asks for location permission itself.

The network address of a request is still seen by NonaShield's servers, as with any internet request.

What your screen must do while it waits. A held payment can take up to about a minute, so:

Your account setting: enforce on the device

One setting on your NonaShield account decides what happens when a payment is risky. NonaShield switches it for you (and your security team sees it on the dashboard).

SettingA serious issue on the device (HIGH or CRITICAL, for example root, hooking, a VPN or a proxy) at payment time
Enforce on device: ONThe SDK blocks on the device whenever a HIGH or CRITICAL threat is present. A threat that can clear (a VPN, a proxy, developer options, screen sharing, open Wi-Fi and similar) blocks only while it lasts; evidence of compromise (root, jailbreak, hooking, tampering) blocks until your security team clears it. A payment returns DENY with critical_issue_enforced.
Enforce on device: OFFNothing blocks on the device. A payment made while a HIGH or CRITICAL threat is present is held and sent to your security team, who choose Allow, Step-up or Block. You receive ALLOW, STEP_UP or DENY (soc_blocked), or DENY (soc_review_timeout) after about a minute with no decision.

The same setting applies at registration and login: with it ON the SDK blocks a device with a critical issue; with it OFF the issue is reported to your security team. Registration is never held. A login or any other API is held for your security team only when you protect it with evaluateApiCheckpoint as shown above; a call you send with evaluateAtCheckpoint is recorded on the dashboard and never waits. A DEVELOPMENT build behaves exactly like PRODUCTION apart from two checks that a test build cannot pass: Google Play Integrity and the store install source (Play Store / App Store). Those are reported to your security team instead of blocking. Everything else, including on-device blocking, is the same in every build.

Your app handles the outcome the same way in both cases, so you do not need to know which setting is active.

Platform note. The waiting checks (evaluatePaymentCheckpoint and evaluateApiCheckpoint, which wait for your security team's review), setLocationConsent and the payment confirmation calls are the same on Android, iOS, React Native, Flutter and Cordova: same names, same decisions (ALLOW, STEP_UP, DENY), same reasons. The Kotlin examples in this section are Android; the iOS, React Native, Flutter and Cordova sections show the same calls in their language. Handle the outcome exactly as described above on every platform.

Behavioural data: tell NonaShield what the user chose

NonaShield learns how each user normally touches and types, as a handful of averages (no screen content, no key codes, no text), to notice when someone else is using the account. In India this is personal data under the DPDP Act, so the choice is the user's and is recorded.

Seeing all installed apps (opt-in, Android)

The SDK no longer adds QUERY_ALL_PACKAGES to your app. Google Play restricts that permission, so you decide whether to ask for it.

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
    tools:ignore="QueryAllPackagesPermission" />

Tell your security team which of the two you chose: with the permission the app checks are complete, without it they are limited to the lists above.

Confirm a payment with the owner's biometric (optional, Android)

By default the payment confirmation is signed by the device key. If your account setting for presence is OS_BIOMETRIC, the confirmation must instead be signed by a second key that Android lets your app use only after the owner's fingerprint or face unlock. NonaShield never sees the biometric or any PIN; your app shows the prompt.

  1. Once per device, register the key. PayShieldSDK.presenceKeyRegistration() returns the body to send to POST /api/v1/device/presence-key through the client from buildSecureHttpClient(). It returns null if it could not create the key.
  2. Ask for the biometric before the payment check, so the payment does not need a step-up round trip. Call PayShieldSDK.presenceSignature() and pass it to your own BiometricPrompt as the crypto object. When the prompt succeeds, call PayShieldSDK.completePaymentPresence(authenticatedSignature, txCommitment) with the same txCommitment you send to the check, and pass the result straight away (it is good for about two minutes, for that one request) as presence to evaluatePaymentCheckpoint(txCommitment = ..., presence = proof). Without it, a payment for an OS_BIOMETRIC account answers STEP_UP. If the answer is STEP_UP anyway, call presenceSignature() again, and when that prompt succeeds call PayShieldSDK.signAfaChallengeWithPresence(authenticatedSignature, afaNonce, tlt) and send the result to /api/v1/payment/confirm with "auth_method": "OS_BIOMETRIC".
  3. If you use your own check instead (your MPIN, OTP or in-app biometric), keep calling signAfaChallenge() and send "auth_method": "CUSTOMER_ASSERTED". NonaShield records this as what your app reported, not as something it checked.

If the owner adds a new fingerprint, Android invalidates the key: presenceSignature() returns null, so register a new key. Keep your own fallback for that case.

Moving to a new phone. On the new phone call POST /api/v1/device/handover/nonce and show the nonce and the new device id to the old phone. On the old phone, PayShieldSDK.approveHandover(newDeviceId, nonce) returns the old device id and a signature; send both from the new phone to POST /api/v1/device/handover/confirm. A phone that was lost or destroyed has no old phone to sign, so use your normal recovery process for that customer.

Protect sensitive fields and the screen (Android)

Screen. You do nothing. The SDK keeps FLAG_SECURE on every screen of your app, including while the app is in the background, so screenshots, screen recordings, screen sharing and the Recent Apps thumbnail all show a blank screen. Do not clear the flag yourself in onPause.

Sensitive fields. Use SecureEditText instead of EditText for passwords, PINs, OTPs and card numbers:

<com.payshield.sdk.integration.SecureEditText
    android:id="@+id/pin"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="numberPassword" />

It masks the text (so an accessibility service reads it redacted), asks the keyboard not to learn from or suggest from what is typed, turns off autofill, copy, cut and the selection menu, and blocks paste unless you set allowPaste = true. For a field that must stay readable, such as an amount, set masked = false; the other protections stay on. Call wipe() when the user leaves the screen or after submitting.

A keyboard app can ignore the "do not learn" request. The SDK reports an untrusted keyboard separately, and it does not provide its own on-screen keyboard.

Use the SDK helpers where your app does the same job. The SDK reports a problem only when the action goes through it. Where your app does something another way, nothing is reported for it at run time:

Your app...UseThe SDK then reports
shows a page in a WebViewSecureWebView.harden(webView), before you load the pageJavaScript, file access or insecure settings (file-URL access, mixed content) found switched on, and turns them off
finishes a payment, a KYC step or an OTPClipboardGuard.clearAfterSensitiveAction(context)the clipboard could not be cleared
keeps sensitive data in a filePayShieldEncryptedFileFactory instead of Filea file name that tries to leave your app's private folder
does nothing specialnothinga sensitive screen shown without FLAG_SECURE, for example because your code cleared the flag
SecureWebView.harden(webView)                                // before loadUrl(...)
ClipboardGuard.clearAfterSensitiveAction(context)            // when the payment, KYC step or OTP is done
PayShieldEncryptedFileFactory.writeBytes(context, "kyc_data.json", bytes)
val saved = PayShieldEncryptedFileFactory.readBytes(context, "kyc_data.json")

SecureWebView.harden switches JavaScript, file access, content access, DOM storage and mixed content off. Do not call it on a page that needs JavaScript; use PayShieldWebViewClient for those pages. The screen check looks at screens whose class name contains payment, kyc, otp, pin, mpin, login, card, account, profile, beneficiary, transfer, withdraw or password.

These reports go to your security team on the dashboard. They never block the device or a payment, and they are available on Android only. Ask your NonaShield contact for the code scanner: it checks the same things in your source before you release, including the WebViews and files that do not go through these helpers.


iOS (Swift)

Requirements: iOS 14+, Xcode 15+.

Step 1 — Add the SDK files. From the PayShieldSDK-iOS zip NonaShield gives you, drag the three frameworks PayShieldKMP.xcframework, TalsecBridge.xcframework and TalsecRuntime.xcframework into your Xcode project and set each to Embed & Sign under your target's Frameworks, Libraries, and Embedded Content. (TalsecBridge and TalsecRuntime are the open-source freeRASP runtime the SDK uses; their MIT licence is in the zip's THIRD_PARTY_LICENSES folder.)

Step 2 — Enable App Attest. Target → Signing & Capabilities → + Capability → App Attest.

Step 3 — Capture touches. In AppDelegate.swift, create your window with the SDK so it can capture behaviour:

import PayShieldKMP

window = PayShieldSDK.shared.makeRootWindow()

Step 4 — Start the SDK once, in application(_:didFinishLaunchingWithOptions:):

let config = PayShieldConfig(
    backendUrl: "https://api.diimeai.com",
    autoBlockSeverity: nil,
    tenantId: "YOUR_SDK_KEY",
    environment: .development,             // .production for your release build (requires backendCertPins)
    backendCertPins: []
)
PayShieldSDK.shared.initialize(config: config)

Step 5 — Register the device (off the main thread — it waits for the network):

DispatchQueue.global(qos: .userInitiated).async {
    if let result = try? PayShieldSDK.shared.enroll() {
        print(result is EnrollmentResult.Success ? "Enrollment OK" : "Enrollment failed")
    }
}

Step 6 — Connect your login. Where your own login succeeds:

try? PayShieldSDK.shared.onUserLogin(userId: loggedInUserId)

On every logout (the button, a session timeout, an account switch):

try? PayShieldSDK.shared.onUserLogout()

This ends the session at once on the device and on NonaShield, instead of when its token expires. The device stays enrolled and the next onUserLogin starts a new session. It is safe to call twice. Reports of security findings wait for the next login.

If your account with DIMEAI asks for the bank's proof of the login, pass the short-lived, single-use token your login service signed for this user (RS256 or ES256). It is sent once, with this login; the SDK's token rotation does not send it again. If your account does not use this, keep the one-argument call above: nothing changes.

try? PayShieldSDK.shared.onUserLogin(userId: loggedInUserId, loginAssertion: tokenFromYourLoginService)

Step 7 — (Optional) Check before another sensitive action (not a payment):

if let result = try? PayShieldSDK.shared.evaluateAtCheckpoint(
        action: "KYC", onDevicePolicy: false, transactionValueTier: .unknown) {
    if result.decision == PolicyDecision.allow { /* continue */ }
    else if result.decision == PolicyDecision.stepUp { /* your extra check */ }
    else { /* stop */ }
}
// Not for payments: evaluateAtCheckpoint(action: "PAYMENT") always returns deny (live_verdict_required). See Step 8.

Step 8 — (Optional) Wait for the payment verdict. The check in Step 7 reports and returns at once. For a payment that must wait for the live verdict (and for your security team when the payment is held) use the waiting check. It is the same call as on Android: **the payment goes ahead only on ALLOW.**

// Optional: the SHA-256 hex of amount, currency and payee, computed by your app. PayShield never receives the raw
// values. With it, a STEP_UP result carries a challenge (result.afaNonce, result.tlt) for Step 9.
let commitment = "<SHA-256 hex of the transaction details>"
PayShieldSDK.shared.evaluatePaymentCheckpoint(transactionValueTier: .unknown, txCommitment: commitment) { result, error in
    guard let result = result, error == nil else { return }          // no answer: not approved
    if result.decision == PolicyDecision.allow { /* call your payment API */ }
    else if result.decision == PolicyDecision.stepUp { /* your extra check, then Step 9 */ }
    else { /* stop the payment */ }
}

For any other API use evaluateApiCheckpoint(action:transactionValueTier:txCommitment:attemptedUserId:) the same way ("KYC", "OTP", "LOGIN", ...). If your customer declines location, report it with PayShieldSDK.shared.setLocationConsent(granted: false). To enable call protection with your customer's consent, call PayShieldSDK.shared.setTelephonyConsent(granted: true) (see "SIM-swap and call protection, with the customer's consent").

Step 9 — (Optional) Confirm the payment. After your own extra check on a STEP_UP, sign the challenge from the result with the device key, and send the signature to /payment/confirm:

let signature = PayShieldSDK.shared.signAfaChallenge(afaNonce: "<result.afaNonce>", tlt: "<result.tlt>")

To require Face ID or Touch ID for the confirmation, register a second key once, then sign with it. The system shows the prompt; NonaShield never sees the biometric. If the customer adds a new face or fingerprint, iOS invalidates the key: register again.

if let registration = PayShieldSDK.shared.presenceKeyRegistration() {
    // send registration.presencePublicKey, registration.ts and registration.proofSignature to
    // POST /api/v1/device/presence-key through your NonaShield-signed client
}
let signature = PayShieldSDK.shared.signAfaChallengeWithPresence(afaNonce: "<result.afaNonce>", tlt: "<result.tlt>")

Protect the screen and sensitive fields (iOS)

Screen. The SDK covers your window with a black view when the app resigns active (so the app-switcher snapshot shows the cover, not a balance or an OTP) and while the screen is being recorded or mirrored. You do nothing. iOS does not allow an app to block or blank a screenshot taken with the side buttons; the SDK reports it after it is taken (SCREENSHOT). It cannot be prevented, and we do not claim it can.

Sensitive fields. Set isSecureTextEntry = true on password, PIN, OTP and card fields. iOS then masks the text and does not allow third-party keyboards in that field.

Third-party keyboards in the rest of the app. iOS lets only your app decide this. In your AppDelegate, refuse keyboard extensions app-wide:

func application(_ application: UIApplication,
                 shouldAllowExtensionPointIdentifier id: UIApplication.ExtensionPointIdentifier) -> Bool {
    return id != .keyboard
}

The SDK cannot do this for you, and iOS gives no API to identify which keyboard is active.


React Native

Requirements: the Android and iOS requirements above.

Step 1 — Install the package NonaShield gives you, then install the iOS pods:

npm install <NonaShield React Native package>
cd ios && pod install

Step 2 — Android: nothing else to add. iOS: enable App Attest (iOS Step 2) and create the window with PayShieldSDK.shared.makeRootWindow() in AppDelegate.swift (iOS Step 3).

Step 3 — Start the SDK once, at app start:

import { PayShieldSdk } from '@payshield/react-native-sdk';

await PayShieldSdk.initialize({
  backendUrl: 'https://api.diimeai.com',
  tenantId: 'YOUR_SDK_KEY',
  autoBlockSeverity: null,
  environment: 'DEVELOPMENT',            // omit for your release build (PRODUCTION, requires backendCertPins)
});

Step 4 — Register the device, right after Step 3:

const enrollment = await PayShieldSdk.enroll();
console.log(enrollment.success ? 'Enrollment OK' : `Enrollment failed: ${enrollment.reason}`);

Step 5 — Connect your login. Where your own login succeeds:

PayShieldSdk.onUserLogin(loggedInUserId);

On every logout (the button, a session timeout, an account switch):

PayShieldSdk.onUserLogout();

This ends the session at once on the device and on NonaShield, instead of when its token expires. The device stays enrolled and the next onUserLogin starts a new session. It is safe to call twice. Reports of security findings wait for the next login.

If your account with DIMEAI asks for the bank's proof of the login, pass the short-lived, single-use token your login service signed for this user (RS256 or ES256) as the second argument. It is sent once, with this login; the SDK's token rotation does not send it again. If your account does not use this, keep the one-argument call above: nothing changes.

PayShieldSdk.onUserLogin(loggedInUserId, tokenFromYourLoginService);

Step 6 — (Optional) Check before another sensitive action (not a payment):

const check = await PayShieldSdk.evaluateAtCheckpoint('KYC');
if (check.decision === 'ALLOW') { /* continue */ }
else if (check.decision === 'STEP_UP') { /* your extra check */ }
else { /* stop */ }
// Not for payments: evaluateAtCheckpoint('PAYMENT') always returns DENY (live_verdict_required). See Step 7.

Step 7 — (Optional) Wait for the payment verdict and confirm it. The check in Step 6 reports and returns at once. evaluatePaymentCheckpoint waits for the live verdict (and for your security team when the payment is held), the same as the native SDKs: **the payment goes ahead only on ALLOW.** evaluateApiCheckpoint(action, ...) protects any other API the same way.

// Optional: the SHA-256 hex of amount, currency and payee, computed by your app. PayShield never receives the raw
// values. With it, a STEP_UP result carries a challenge (check.afaNonce, check.tlt).
const commitment = '<SHA-256 hex of the transaction details>';
const check = await PayShieldSdk.evaluatePaymentCheckpoint('UNKNOWN', commitment);
if (check.decision === 'ALLOW') { /* call your payment API */ }
else if (check.decision === 'STEP_UP' && check.afaNonce && check.tlt) {
  // after your own extra check, sign the challenge and send the signature to /payment/confirm
  const signature = await PayShieldSdk.signAfaChallenge(check.afaNonce, check.tlt);
}
else { /* stop the payment */ }

PayShieldSdk.setLocationConsent(false);   // if your customer declines location
PayShieldSdk.setTelephonyConsent(true);   // SIM-swap and call protection: the customer agreed (call before initialize)

To require the owner's biometric for the confirmation, register a second key once, then sign with it. The system shows the prompt (Android: your current activity must be a FragmentActivity; iOS: Face ID or Touch ID); NonaShield never sees the biometric. If the owner adds a new fingerprint or face, the key is invalidated: register again.

const registration = await PayShieldSdk.presenceKeyRegistration();
// send registration.presencePublicKey, registration.ts and registration.proofSignature to
// POST /api/v1/device/presence-key through your NonaShield-signed client
const signature = await PayShieldSdk.signAfaChallengeWithPresence('<check.afaNonce>', '<check.tlt>');

Flutter and Cordova

Both are thin wrappers over the same native SDK, with the same customer calls as React Native: start, register the device, connect your login, the check before a payment and before any other API (evaluateAtCheckpoint, evaluatePaymentCheckpoint, evaluateApiCheckpoint), the payment confirmation (signAfaChallenge, presenceKeyRegistration, signAfaChallengeWithPresence, approveHandover), setLocationConsent, setTelephonyConsent, assertAllowed, getAccessIssue, isBlocked and getBlockDetails. The demo and diagnostic calls (signal inspection, enrolment counters) stay in the native and React Native SDKs.

onUserLogin(...), evaluateAtCheckpoint(...), evaluatePaymentCheckpoint(...). For the biometric confirmation on Android your MainActivity must extend FlutterFragmentActivity. See flutter-sdk/README.md.

On Android the plugin adds a small transparent activity to show the biometric prompt. See cordova-sdk/README.md.

On both, autoBlockSeverity / autoBlock is required and has no default, exactly as in the native SDKs. NonaShield will tell you which value to use. These two wrappers are new; run them on a device in your own app before release.


Harden your app build (optional, Android)

A separate Gradle plugin, com.payshield.hardening, hardens your own app's compiled code — it does not touch the SDK. Apply it in your app module, not in a library module that only wraps the SDK.

What it does:

CapabilityWhat it does
Renaming dictionaryGenerates a per-build list of identifier names and wires it into R8 (-obfuscationdictionary) so renamed classes/methods change build to build, not just once
String encryptionEncrypts string literals in your compiled classes (AES-256-GCM, per-build key) and replaces each with a call to a generated decrypt method
Metadata strippingRemoves source-file name, line numbers and local-variable names from your release build; optionally strips annotations you explicitly list

What it does not do: control-flow obfuscation, code that restructures itself at runtime, or renaming native (.so) libraries. These need a commercial obfuscator; we do not bundle one, and say so rather than claim it.

Setup — project-level build.gradle:

plugins {
    id 'com.payshield.hardening' version 'x.y.z' apply false   // version from your NonaShield contact
}

App module's build.gradle:

plugins {
    id 'com.android.application'
    id 'com.payshield.hardening'
}

payshieldHardening {
    // All optional — shown with their defaults.
    enabled = true
    stringEncryption = true
    metadataStripping = true
    minStringLength = 5
    dictionarySeed = System.currentTimeMillis()   // fix this to a stable value for reproducible builds
    dictionarySize = 2000
    stripAnnotationDescriptors = []                // e.g. ["Lcom/yourapp/internal/DebugOnly;"]
    excludedPackagePrefixes = []                   // e.g. ["com/yourapp/generated/"]
}

String encryption and metadata stripping only take effect on a build type with minifyEnabled true — they run against R8's output, after shrinking, so R8 has already decided what your code needs before either transform touches it. Build your release APK/bundle as normal; nothing else changes about your build process.


Use this section for the consent panel. On Android it is part of the NonaShield SDK you already added (com.payshield.sdk.consent); there is no second SDK and no second initialize. If your NonaShield agreement covers consent evidence only (DPDP consent records) and not the threat and fraud product, a consent-only tenant gets the consent calls and nothing else: the server refuses every other route (threat batches, ingest, telemetry, payment, device commands and the rest) with 403 ENTITLEMENT_NOT_GRANTED. A separate consent-only artifact that ships no threat detection is not built yet; the Android panel below is available in the standard AAR (it needs androidx.biometric, which the AAR declares).

The calls (Android)

Set up the SDK as in "The Standard Integration" (initialize, enroll, onUserLogin), then:

val result = PayShieldConsent.present(activity, sessionId, language = null)   // shows the panel; returns ConsentResult
PayShieldConsent.withdraw(dashboardSessionId, purposeCode)                   // one signed call; returns ConsentResult
PayShieldConsent.list(dashboardSessionId)                                    // the person's consents: List<ConsentItem>
PayShieldConsent.theme = ConsentTheme(accent = 0xFF0B5FFF.toInt())          // optional colours
PayShieldConsent.strings = ConsentStrings(title = "...")                     // optional fixed texts

present, withdraw and list are suspend functions and throw ConsentException(code). Codes: CANCELLED (the person closed the panel or the biometric prompt; nothing was recorded), NOT_READY (no device credential yet), BUSY (a panel is already open), NOTICE_LANGUAGE_UNAVAILABLE, NETWORK, or the server's own code (NOTICE_HASH_MISMATCH, SESSION_EXPIRED, SESSION_NOT_FOUND, ...). ConsentResult carries artefactIds and receiptHashes. On demo and trial servers PayShieldConsent.demoSession() (or demoSession(dashboard = true) for withdraw and list) asks the server for a session so no customer server is needed; production servers refuse it.

Your server creates the session first (POST /api/v1/consent/sessions, with your API key; type CONSENT for present, type DASHBOARD for withdraw and list) and hands the session id to the app. The panel fetches the notice, shows it exactly as published in one language for the whole notice (the one you pass, else the device language, else the first language the notice offers in full; there is no per-purpose fallback), with accept and decline of equal size, nothing pre-selected, and submit disabled until every consent purpose has a choice. Declaration and acknowledgement purposes show one unchecked confirm box each; legitimate-use purposes are informational. On submit the OS biometric prompt unlocks the presence key (fingerprint or face, strong class). If the device has no biometric set up, the panel shows a fixed message and offers no weaker path. The sheet window is FLAG_SECURE. The app needs no extra permission.

Under each purpose the panel shows the personal data it uses, from the notice's data_items for that purpose, as "Data used: KYC, Mobile number, Location". List them in your notice so the person sees them; a purpose without data_items shows no such line. Change the label with ConsentStrings(dataUsed = "...") (Android) or ConsentStrings.dataUsed (iOS). The same line appears in the web widget (label option dataUsed).

list is a POST with the same signed envelope as the other device calls (POST /api/v1/consent/device/list), because the edge accepts only signed JSON bodies on device routes. Every device call is signed with the existing X-PayShield-* headers; nothing about the signed input changes.

The iOS panel ships inside the existing iOS SDK, with no new framework. The consent calls are in PayShieldKMP (PayShieldConsentClient); the SwiftUI view is a few source files you add to your app: copy ios-consent-ui/Sources/PayShieldConsentUI/*.swift next to the three frameworks from iOS Step 1. It needs iOS 14 or later, and NSFaceIDUsageDescription in your Info.plist.

// After initialize, enroll and onUserLogin (the standard integration), with a session id from your server:
ConsentView(sessionId: sessionId, language: "en") { phase in
    // .recorded, .cancelled, .biometricUnavailable or .failed(code)
}

What the panel does:

shows the text in ONE language for the whole notice (your requested language if every purpose has text in it, otherwise the first language that is complete, otherwise NOTICE_LANGUAGE_UNAVAILABLE and no controls).

has a choice and every declaration is confirmed.

Face ID or Touch ID. If the person cancels, nothing is sent and nothing is recorded.

App Attest stays the hardware proof of the device key.

The calls behind the panel, for apps that draw their own screen (all are blocking: call them off the main thread): PayShieldConsentClient.shared.fetchNotice(sessionId:language:), submitDecision(notice:sessionId:selections:), withdraw(sessionId:purposeCode:txnIdentifier:) and list(sessionId:). hasPresenceKey() and preparePresenceKey() create and register the presence key once per device; the panel does this for you.

ios-consent-sample/ is a small app that shows the whole flow against the demo server.

What each proof label proves

The label is set by the server from what it verified. Nothing in a request can choose or raise it.

LabelChannelWhat it provesWhat it does not prove
HW_ATTESTEDAppA hardware-backed device key, vouched for at enrolment, signed this exact decision.That the right person held the phone. Presence is only asserted (below).
DEVICE_KEYAppAn enrolled device key without hardware attestation signed this decision.Hardware protection of the key.
ASSISTEDKiosk or call centreAn attested operator device recorded the person's own gesture; the operator reference is stored.Anything about the person beyond the operator's device.
PASSKEYWebA passkey ceremony completed on your site's origin for this session.Who the person is: that link is your own login.
WEB_FINGERPRINTWebA clean web-SDK verdict from this origin inside this session's time window.Identity.
SESSION_BOUNDWebThe decision came from the browser the session was bound to.That the device signed it.
SERVER_ASSERTEDYour serverYour server told us the person agreed.Anything about the person's device.

User presence is asserted, not proven

The app asks the OS for a biometric and the presence key signs the decision. The server stores user_presence = ASSERTED when that signature checks out and NONE otherwise. The server cannot prove that the key demands a biometric, so receipts say "asserted by the device, not proven". The presence signature covers SHA-256 over the bytes nonashield-consent-presence-v1, a newline (\n), and the canonical JSON of the payload without the PresenceSignature field.

Web widget

For the browser, use the consent widget in the web SDK. Options: passkey: true runs a passkey ceremony bound to the session and sends AssertionRef; passkey: "required" stops if the browser has no WebAuthn. If you give the widget a fingerprint source it sends FingerprintRequestId. If both are sent the passkey wins, and a reference that is sent but fails is refused (403), never downgraded.

Honest limits

Lending apps and NBFCs: compliance checklist

Use this list for a digital lending app (your own, or one run by a lending service provider on your behalf). Paragraph numbers are from the RBI (Non-Banking Financial Companies - Credit Facilities) Directions, 2025, Chapter III, as read on rbi.org.in on 27 November 2026; confirm every point with your own compliance team before you rely on it.

Rule (paragraph)What to do with NonaShield
The app must not access file and media, contact list, call logs or telephony; one-time camera, microphone or location only for onboarding / KYC, with explicit consent (13(1))NonaShield declares none of the contacts, SMS, call-log, storage or location permissions. Do not add them for NonaShield. Call setLocationConsent(false) once KYC is done. Enable SIM and call protection only with the customer's consent (setTelephonyConsent), or switch it off with enableTelephonySignals = false if your policy is never to use telephony. Your own counsel decides how 13(1) applies to telephony.
Data collection is need-based, with consent and an audit trail (13(1))Show your notice before each switch above, and keep the record of each customer's choice in your own consent records; the SDK holds the answer in memory only.
No biometric data unless the law allows (14(3))Behavioural data (touch and typing patterns) is on by default. Set enableBehavioral = false until your counsel has decided whether it counts as biometric data. Withdrawal erases the user's behavioural template (see "Behavioural data").
All data on servers in India; if processed abroad, deleted and brought back within 24 hours (14(4))Run the NonaShield stack in your own cloud account or on-premise in an Indian region. Nothing leaves your environment by default.
Disbursal only to the borrower's own bank account (10(1))Send bank-account changes, disbursal and e-mandate steps through evaluateApiCheckpoint so each one is checked and recorded.
You are fully liable for your lending service providers' apps (6(7))Put the SDK in every app that serves your borrowers: your own, your lending service providers' and your field and collections apps, so one dashboard sees them all.
Technology and cybersecurity standards apply to you and your providers (16)Keep autoBlockSeverity as NonaShield agreed with you, pin the NonaShield certificate (backendCertPins) in production, and use the signed SDK file.

Reporting is yours, with evidence from NonaShield: cyber incidents to RBI within six hours of detection, through the RBI portal for NBFCs (HFCs report to NHB), under the NBFC Cybersecurity, Technology: Risk, Resilience and Assurance Framework Directions, 2026 (paragraphs 28 and 141); frauds on the RBI fraud-monitoring return within 14 days of classification, under the NBFC Fraud Risk Management Directions, 2026 (paragraph 43). The NonaShield dashboard produces the incident evidence pack and the fraud early-warning report that support both filings.

Check that it works

Run the app on a real phone. You should see Enrollment OK in your log. Log in once, then tell your NonaShield contact — they will confirm your device appears on your NonaShield dashboard.

Security findings on the device (a rogue build, hooking, tampering) are reported as soon as enrollment succeeds, before anyone logs in. They are not held back until onUserLogin; the device is linked to a user at the first login.

Rules

If something goes wrong

What you seeWhat to do
Unresolved reference / Cannot access class (Android)Use the latest SDK file from NonaShield, then Build → Clean Project and Rebuild Project
Module was compiled with an incompatible version of KotlinUpgrade the Kotlin Gradle plugin to 2.1 or newer
NoClassDefFoundError naming okhttp3, androidx.security or com.google.android.playA library from Android Step 2 is missing
Enrollment failedCheck internet access and that YOUR_SDK_KEY is correct; send us the log line
Enrollment failed starting SUBSCRIPTION_LAPSED, TRIAL_EXPIRED or TENANT_KEY_INVALIDAccess has ended or the key is wrong. Pay the open invoice or write to contactus@diimeai.com. PayShieldSDK.getAccessIssue() shows the same code
Enrollment failed starting APP_NOT_REGISTEREDThis app is not on your list. Open your dashboard, Apps, and add its app id (the message names it). No new build and no SDK change is needed: enrol again
Enrollment OK but nothing on the dashboardThe user ID in "Connect your login" has a disallowed character

Questions: contactus@diimeai.com