crokta_liveness 1.4.0
crokta_liveness: ^1.4.0 copied to clipboard
A Flutter SDK for Face Liveness Verification, passive/active liveness UI.
Crokta Liveness SDK #
A production-grade, enterprise-ready biometric liveness verification solution designed for Flutter applications utilizing the FaceGuard biometric suite. It aggregates and validates AWS Rekognition and Google ML Kit Face Liveness sessions.
Features #
- Anti-Spoof Defense: Supports passive and active challenge fallbacks to prevent screen replay, deepfakes, printed/synthetic media attacks, etc.
- Provider Abstraction: Swappable liveness engines (AWS Rekognition, Google ML Kit, Mock) dynamically without changes to downstream client apps.
- KYC Upgrade Flow: Supports upgrade checks (Mutual Exclusivity BVN $\leftrightarrow$ NIN) using a strict comparison against the onboarding reference photo with a 0.40 similarity threshold.
- Advanced ML Kit Gestures: Features eye-blink detection alongside head movements (Tilt Up, Tilt Down, Tilt Sideways).
1. Project Integration #
Dependencies #
In your app's pubspec.yaml, add the dependency:
dependencies:
crokta_liveness:
path: path/to/liveness_sdk
Android Permissions #
Add to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.front" />
iOS Configuration #
Add to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app requires camera access to perform biometric face liveness checks during verification actions.</string>
2. SDK Initialization #
Initialize the SDK once during application startup (e.g., inside main.dart):
import 'package:crokta_liveness/crokta_liveness.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await LivenessSDK.initialize(
backendUrl: 'https://api.staging.faceguard.com',
apiKey: 'your-app-api-key',
environment: LivenessEnvironment.staging,
timeoutSeconds: 15,
);
runApp(const MyApp());
}
3. Launching Verification #
Call LivenessSDK.verify(context) when intercepting secure flows.
Example: Onboarding Verification #
void onOnboardingTriggered(BuildContext context) async {
// 1. Launch liveness scanning interface
final result = await LivenessSDK.verify(
context,
userId: 'customer-uuid-created-on-backend',
kycType: 'bvn',
kycNumber: '11122233344',
verificationType: 'ONBOARDING',
channel: 'personal',
);
if (!result.success || result.status != LivenessStatus.pass) {
showErrorBlock('Biometric verification failed.');
return;
}
proceedWithRegistration();
}
Example: KYC Upgrade Verification #
void onKycUpgradeTriggered(BuildContext context, String customerId) async {
final result = await LivenessSDK.verify(
context,
userId: customerId,
kycType: 'nin',
kycNumber: '99988877766',
verificationType: 'KYC_UPGRADE',
channel: 'personal',
);
if (!result.success || result.status != LivenessStatus.pass) {
showErrorBlock('KYC Upgrade biometric check failed.');
return;
}
proceedWithUpgradeCompletion(result.sessionId);
}
Example: Face Verification Check (No KYC details required) #
void onFaceVerificationTriggered(BuildContext context, String customerId, String channel) async {
final result = await LivenessSDK.verify(
context,
userId: customerId,
verificationType: 'VERIFICATION',
channel: channel,
);
if (!result.success || result.status != LivenessStatus.pass) {
showErrorBlock('Face Match comparison failed. Access blocked.');
return;
}
proceedWithTransaction();
}