laligence_ekyc 0.2.5
laligence_ekyc: ^0.2.5 copied to clipboard
Official Laligence eKYC SDK for Flutter. Drop-in identity verification with document capture, liveness detection, and face matching.
laligence_ekyc #
Official Flutter SDK for the Laligence eKYC identity verification service.
Drop-in identity verification with:
- Document capture — camera or gallery picker for passport / national ID
- MRZ extraction — machine-readable zone parsed on the server (name, DOB, expiry, nationality)
- Active liveness — challenge-response (blink, open mouth, turn head)
- Passive liveness — deep neural anti-spoof model (MiniFASNetV2-SE)
- Face matching — dlib 128-D encoding compared against the ID photo
The full flow is triggered with a single await LaligenceEKYC.verify(...) call and returns a typed VerificationResult.
Installation #
Add to your pubspec.yaml:
dependencies:
laligence_ekyc: ^0.2.5
Then run:
flutter pub get
Platform setup #
Android #
Add these permissions to android/app/src/main/AndroidManifest.xml inside <manifest>:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
Set minSdkVersion to at least 21 in android/app/build.gradle:
defaultConfig {
minSdkVersion 21
}
iOS #
Add these keys to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Camera is used to capture your ID and verify your identity.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is used to upload your identity document.</string>
Usage #
import 'package:laligence_ekyc/laligence_ekyc.dart';
final result = await LaligenceEKYC.verify(
config: const EKYCConfig(
apiKey: 'lal_your_api_key_here', // issued from the Laligence dashboard
baseUrl: 'https://ekyc.laligence.com', // or your self-hosted server URL
),
context: context,
);
if (result.passed) {
print('Verified! Session: ${result.sessionId}');
print('Name: ${result.mrzData?.givenNames} ${result.mrzData?.surname}');
} else if (result.cancelled) {
print('User cancelled.');
} else {
print('Failed: ${result.failureReason}');
}
Configuration #
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey |
String |
required | API key starting with lal_. Obtain from the Laligence dashboard or your admin endpoint. |
baseUrl |
String |
https://ekyc.laligence.com |
Base URL of the eKYC backend. Change for self-hosted deployments. |
timeout |
Duration |
30s |
Request timeout for all API calls. |
primaryColor |
Color |
Color(0xFF1976D2) |
Accent color used in the verification UI (buttons, oval guide, progress). |
Result fields #
| Field | Type | Description |
|---|---|---|
passed |
bool |
true if all checks passed. |
cancelled |
bool |
true if the user dismissed the flow without completing it. |
failureReason |
String? |
Human-readable failure message when passed is false. |
sessionId |
String? |
Backend session ID — useful for your own audit records. |
mrzData |
MRZData? |
Parsed document fields (name, DOB, expiry, nationality, document number). |
faceDistance |
double? |
Face matching distance (lower = more similar; threshold: 0.6). |
livenessScore |
double? |
Passive liveness confidence score from the anti-spoof model. |
Verification flow #
LaligenceEKYC.verify()
│
▼
DocumentCaptureScreen
Camera / Gallery → POST /api/document/upload
│
▼ session_id + MRZ data
LivenessScreen — Phase 1: Active liveness
Front camera → GET /api/liveness/challenge (blink / open mouth / turn head)
→ POST /api/liveness/check (frames until passed)
│
▼ challenge passed
LivenessScreen — Phase 2: Selfie + face match
Front camera → POST /api/verify/frame (frames until pass / fail)
│
▼
VerificationResult returned to caller
Self-hosted deployment #
If you run your own instance of the eKYC backend:
EKYCConfig(
apiKey: 'lal_your_key',
baseUrl: 'https://your-server.example.com', // no trailing slash
)
To create an API key on your server:
curl -X POST https://your-server.example.com/admin/clients \
-H "X-Master-Key: your_master_key" \
-H "Content-Type: application/json" \
-d '{"name": "My Mobile App"}'
# → { "api_key": "lal_xxx...", "client_id": 1 }
License #
MIT — see LICENSE.