Mobile SDK & plugins
Install NIV2FA in Flutter, Ionic, Capacitor, Cordova, React Native, Java/Kotlin, or Swift. Call configure(apiKey, projectId) first — API works only with a valid key and an active project trial/subscription. Android reads SIM1/SIM2 (+ saved owner contacts); iOS reads Contacts (My Card + "my number" contacts).
Quick links
Platform matrix
No manual SIM entry. The SDK reads device lines after the user Allows access. Android: SIM chip + saved contacts. iOS: Contacts Me card + saved "my number" contacts. Any matching line → success.
| Stack | Path | Devices | SIM read |
|---|---|---|---|
| Java / Kotlin | android/ | Android | SIM1/SIM2 + saved owner contacts |
| Swift | ios/ | iOS | Contacts Me + saved "my number" contacts |
| Capacitor / Ionic | packages/capacitor | Android + iOS | Native SDK per OS |
| Cordova / Ionic Cordova | packages/cordova | Android + iOS | Native SDK per OS |
| Flutter | packages/flutter | Android + iOS | Native SDK per OS |
| React Native | packages/react-native | Android + iOS | Native SDK per OS |
How it works
- Your backend calls
POST /secure-api/v1/verificationswith the claimed phone +projectId. - API returns
verifyUrl(and QR). - Your app calls
openVerify({ url })(SDK WebView / Agent). - User Allows permission — SDK reads device line(s) (SIM and/or Contacts — never typed by the user).
- If any reported line matches the registered number →
matched: true+ webhookidentity.verified. - SDK returns success to your app UI.
Shared methods & result
| Method | Purpose |
|---|---|
requestPermissions() | Ask user to Allow Phone / identity access (Deny cancels) |
getSimPhones() | SIMs read by the native SDK bridge |
openVerify({ url }) | Permission → auto-read → match → { matched, matchedSlot, sessionId } |
{
"matched": true,
"status": "completed",
"matchedSlot": "sim1",
"sessionId": "sess_…",
"platform": "android" | "ios"
}
Always treat the webhook as the source of truth for your backend.
Permissions (Allow — SDK reads SIMs)
Android: READ_PHONE_STATE, READ_PHONE_NUMBERS, READ_CONTACTS, CAMERA, INTERNET, ACCESS_NETWORK_STATE. Reads SIM1/SIM2; also scans saved contacts named e.g. My number or رقمي if SIM MSISDN is blank.
iOS: Contacts permission → read My Card (Me) plus saved owner contacts (same naming patterns) → compare to session. Not SIM chip. No background calls. Add NSContactsUsageDescription in Info.plist.
Chrome / plain browser cannot read SIMs — open verifyUrl inside the SDK or Agent only.
Android (Java / Kotlin)
Docs: ANDROID.md · Module: android/
git clone https://github.com/kreatedeviq/niv2fa-sdk.git
# settings.gradle
include ':niv2fa-sdk'
project(':niv2fa-sdk').projectDir = new File('path/to/niv2fa-sdk/android')
# app/build.gradle
implementation project(':niv2fa-sdk')
Niv2faSdk.requestPermissions(this) startActivityForResult(Niv2faSdk.verifyIntent(this, sessionUrl), 9101) // onActivityResult → Niv2faSdk.parseResult(data)
iOS (Swift)
Docs: IOS.md · Package: ios/ (SPM)
.package(url: "https://github.com/kreatedeviq/niv2fa-sdk.git", from: "1.0.0")
// product: Niv2faSdk
Niv2faSdk.openVerify(from: self, sessionUrl: url) { result in
// result.matched — no manual SIM typing
}
Same product rule: SDK bridge only. For dual-SIM chip MSISDN, Android SDK / Agent is the reliable path (Apple limits silent MSISDN).
Capacitor / Ionic Capacitor
Docs: CAPACITOR.md · Android + iOS
npm i https://github.com/kreatedeviq/niv2fa-sdk/packages/capacitor
npx cap sync
import Niv2fa from '@niv2fa/capacitor'
await Niv2fa.requestPermissions()
const r = await Niv2fa.openVerify({ url: verifyUrl }) // SDK reads SIMs → match
Cordova / Ionic Cordova
Docs: CORDOVA.md · Android + iOS
cordova plugin add https://github.com/kreatedeviq/niv2fa-sdk.git#main:packages/cordova
Niv2fa.requestPermissions(console.log, console.error)
Niv2fa.openVerify({ url: verifyUrl }, console.log, console.error)
Flutter
Docs: FLUTTER.md · Android + iOS
dependencies:
niv2fa_flutter:
git:
url: https://github.com/kreatedeviq/niv2fa-sdk.git
path: packages/flutter
await Niv2faFlutter.requestPermissions();
final r = await Niv2faFlutter.openVerify(verifyUrl);
React Native
Docs: REACT_NATIVE.md · Android + iOS
import { openVerify, requestPermissions } from '@niv2fa/react-native'
await requestPermissions()
const r = await openVerify(verifyUrl)
Adjustment & making it work
- Set project
webhook_urlin the dashboard. - Create session with the exact phone the user claims (E.164).
- Open
verifyUrlviaopenVerifyin the SDK (not Chrome). - User Allows Phone — SDK reads SIM1/SIM2 automatically.
- Match → success response to the app + webhook
identity.verified.
Common issues
| Symptom | Fix |
|---|---|
SDK_REQUIRED | Open verify inside SDK / Agent — browsers cannot read SIMs |
| Permission denied | User must Allow Phone; call requestPermissions again |
| Empty SIM list (Android) | Carrier left MSISDN blank on chip; check SIM status in Settings |
| Mismatch | SDK-read number ≠ registered session phone — expected fail |
| Gradle / plugin missing | Fix path / cap sync / clean rebuild |
Clone
git clone https://github.com/kreatedeviq/niv2fa-sdk.git cd niv2fa-sdk # Guides: docs/ANDROID.md · IOS.md · CAPACITOR.md · CORDOVA.md · FLUTTER.md · REACT_NATIVE.md