crokta_liveness 1.5.0 copy "crokta_liveness: ^1.5.0" to clipboard
crokta_liveness: ^1.5.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 #

  1. Anti-Spoof Defense: Supports passive and active challenge fallbacks to prevent screen replay, deepfakes, printed/synthetic media attacks, etc.
  2. Provider Abstraction: Swappable liveness engines (AWS Rekognition, Google ML Kit, Mock) dynamically without changes to downstream client apps.
  3. 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.
  4. 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 #

The native AWS Face Liveness UI on iOS requires iOS 15.5 and uses Flutter's built-in Swift Package Manager (SPM) integration to automate native setup.

1. Enable Swift Package Manager

Ensure Flutter's SPM support is enabled on your machine:

flutter config --enable-swift-package-manager

2. Set iOS Deployment Target to 15.5

The ML Kit dependencies require iOS 15.5+. Ensure your project's deployment target is updated to at least 15.5 in:

  • The Xcode project configuration (Runner.xcodeproj -> Deployment Target)
  • Your ios/Podfile platform definition:
    platform :ios, '15.5'
    

And update your ios/Podfile's post_install block to enforce 15.5 across target builds if needed.

3. Configure Permissions

Add camera and microphone usage descriptions to your ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app requires camera access to perform biometric face liveness checks during verification actions.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required during the liveness verification session.</string>

Note: A missing NSCameraUsageDescription will result in an immediate crash as soon as the camera opens.

4. Build and Run

On a physical iOS device (AWS Face Liveness does not function on simulators):

flutter pub get
pod install --project-directory=ios
flutter run

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();
}
0
likes
140
points
597
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter SDK for Face Liveness Verification, passive/active liveness UI.

Homepage

License

MIT (license)

Dependencies

amplify_auth_cognito, amplify_flutter, camera, face_liveness_detector, flutter, google_mlkit_face_detection, http, path_provider, uuid

More

Packages that depend on crokta_liveness

Packages that implement crokta_liveness