verification_sdk 1.0.0
verification_sdk: ^1.0.0 copied to clipboard
Flutter SDK for multi-stage identity verification
verification_sdk #
Flutter SDK for multi-stage identity verification (mobile OTP, DigiLocker Aadhaar fetch, face-match). Drop-in UI, hosted flows, and host callbacks for integration.
Quick start #
- Add the package (local or from pub.dev):
dependencies: verification_sdk: path: verification_sdk: ^1.0.0 - Initialize the SDK once (before first use):
import 'package:verification_sdk/verification_sdk.dart'; await VerificationSDK.initialize( clientId: 'YOUR_CLIENT_ID', sessionToken: 'YOUR_SESSION_TOKEN', environment: Environment.sandbox, userData: { 'mobileNumber': '9123456789', 'brandLogoUrl': 'https://example.com/logo.png', 'brandTitle': 'Acme Inc.', 'primaryColor': '#1E88E5', }, ); - Launch the verification flow from any BuildContext:
VerificationSDK.startVerification(context, callbacks: VerificationCallbacks( onStageComplete: (stage) => debugPrint('stage: $stage'), onError: (err) => debugPrint('sdk error: $err'), onComplete: (result) => debugPrint('sdk complete: $result'), ), );
Initialization options #
- Required:
clientId(string)sessionToken(string)environment(Environment.sandbox | Environment.production)
- Optional
userDatakeys:mobileNumber— prefill mobile (string)brandLogoUrl— header logo (string: URL)brandTitle— optional title (string)primaryColor— overrides SDK primary color (accepted formats):- integer: 0xAARRGGBB (e.g. 0xFF1E88E5)
- hex string: "#RRGGBB", "RRGGBB" (alpha assumed FF)
- hex string with alpha: "AARRGGBB"
Platform setup #
Android
- Add to
android/app/src/main/AndroidManifest.xml:<uses-permission android:name="android.permission.CAMERA"/><uses-permission android:name="android.permission.INTERNET"/>
- Ensure WebView is available/updated on target devices (Digilocker uses WebView).
iOS
- Add to
ios/Runner/Info.plist:NSCameraUsageDescription— explanation for camera access.
- Ensure App Transport Security allows required endpoints (HTTPS recommended).
Permissions are requested at runtime where required.
What the SDK does (integrator view) #
- Presents a bottom-sheet flow above your app to:
- Send OTP and verify mobile
- Fetch Aadhaar XML from DigiLocker (WebView OIDC)
- Capture a front-camera selfie and run face-match against Aadhaar photo (upload via presigned URL)
- Returns progress events and final result via
VerificationCallbacks:onStageComplete(Map)— stage-level progress- onError(String) — errors
- onComplete(Map) — final result when SDK closes
Example (local example app) #
An example app is included in example that demonstrates:
VerificationSDK.initialize(...)VerificationSDK.startVerification(...)usage
Run it:
cd example
flutter pub get
flutter run
Theming & Branding #
- Use
userData['brandLogoUrl']to show your logo in the header. - Override UI accent with primaryColor described above.
Testing & debugging #
- Test on a physical device for camera and WebView behavior.
- Typical failure modes:
- Camera permission denied — user must grant camera access.
- Presign upload issues — server must sign correct headers (x-amz-...).
- WebView renderer crashes on some emulators — verify on physical device.
Support & contact #
For integration questions, provide:
- Client ID and environment details (sandbox vs production)
- Example sessionToken acquisition method (server-side)
- Any custom navigator or host-app constraints