Skip to main content

smartverify_biometric 1.0.2 copy "smartverify_biometric: ^1.0.2" to clipboard
smartverify_biometric: ^1.0.2 copied to clipboard

Flutter biometric facial capture and anti-spoofing liveness verification SDK for SmartVerifyNG. Guides users through on-device liveness checks and validates captured faces against the SmartVerify liveness API.

smartverify_biometric #

Official Flutter SDK for SmartVerifyNG Biometric Facial Capture & Liveness Verification.

Guide users through real-time on-device liveness checks (face alignment, smile, and blink detection) and automatically submit the captured face to the SmartVerifyNG Liveness Check API (POST /api/v1/verify/liveness).

Security-First Webhook Architecture #

Because client mobile apps embed a public key (pk_...), exposing liveness scores or verification decisions directly to the client would allow someone who extracts a public key to run unauthorized liveness checks at the key owner's expense.

To protect developers:

  • The SDK authenticates using your public key via the X-PUBLIC-KEY header and rejects secret keys (sk_...) at initialization.
  • onComplete returns only the safe submission status (status, isSuccess), the clear provider message, and the reference (plus optional locally captured image bytes).
  • The full liveness verdict, confidence score, and anti-spoofing checks are never returned to the client SDK — SmartVerify delivers them exclusively to your configured server-side webhook, which you correlate using reference.

Features #

  • Public-Key Authentication (X-PUBLIC-KEY): Rejects sk_... secret keys automatically.
  • Guided On-Device Active Liveness + Voice Prompts: Circular face viewport with animated instructions, spoken Text-to-Speech voice guidance (with mute/unmute toggle), face centering/pose validation, sustained smile verification, and blink verification powered by Google ML Kit.
  • Instant Direct-Face Capture: Captures the user's aligned direct face straight from the live stream during the smile/open-eyes liveness moment with zero post-blink shutter lag.
  • Webhook-Only Verdict Protection: Client callback receives only status, reference, and clear provider message; full scores & anti-spoofing results go strictly to your webhook.
  • Customizable UI, Voice & Retry Handling: Configure titles, copy, voice language/rate, thresholds, error retries, and theming via SmartVerifyCaptureOptions and SmartVerifyTheme.

Installation #

Add smartverify_biometric to your pubspec.yaml:

dependencies:
  smartverify_biometric: ^1.0.0

Then run:

flutter pub get

Platform Setup #

Android #

  1. Ensure minSdk is at least 21 in android/app/build.gradle (or build.gradle.kts).
  2. Add the camera permission to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />

iOS #

  1. Set the minimum iOS deployment target to 15.5 or higher in ios/Podfile (required by google_mlkit_face_detection).
  2. Add NSCameraUsageDescription to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Camera access is required to capture your face for biometric liveness verification.</string>

Quick Start #

1. Initialize with your Public Key #

Initialize the SDK once (e.g. in main()):

import 'package:smartverify_biometric/smartverify_biometric.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  SmartVerifyBiometric.initialize(
    publicKey: 'pk_live_your_public_key_here',
    defaultThreshold: 65.0, // optional (API default: 65.0)
  );

  runApp(const MyApp());
}

Security Note: Never pass a secret key (sk_live_... / sk_test_...) in your Flutter app. SmartVerifyBiometric.initialize throws an ArgumentError if a secret key is supplied.

2. Launch Biometric Capture & Handle onComplete #

await SmartVerifyBiometric.instance.startLivenessCheck(
  context: context,
  reference: 'TXN_LIVE_CHECK_001', // pass your unique reference to match the webhook
  onComplete: (SmartVerifyLivenessResult result) {
    if (result.isSuccess) {
      // Capture was accepted by SmartVerify.
      // Poll your backend or wait for your server webhook using result.reference.
      debugPrint('Submitted (${result.reference}): ${result.message}');
    } else {
      // Submission failed — display or log the clear provider message.
      debugPrint('Error (${result.errorCode}): ${result.message}');
    }
  },
  onCancel: () {
    debugPrint('User closed biometric capture before completion.');
  },
);

3. Embed SmartVerifyCaptureScreen Directly (Optional) #

If you use GoRouter or custom navigation, render SmartVerifyCaptureScreen directly:

SmartVerifyCaptureScreen(
  reference: 'TXN_LIVE_CHECK_002',
  options: const SmartVerifyCaptureOptions(
    title: 'Verify Your Identity',
    allowRetryOnError: true,
  ),
  theme: const SmartVerifyTheme(
    primaryColor: Color(0xFF059669),
  ),
  onComplete: (result) {
    // Proceed with your app flow; consume the full verdict from your webhook.
  },
);

SmartVerifyLivenessResult Overview #

Property Type Description
status String API response status string (e.g. success, error).
isSuccess bool Whether the capture was accepted by the SmartVerify API (HTTP 2xx).
message String Clear human-readable response message returned by the SmartVerify API.
reference String? Transaction reference to correlate with the full webhook payload on your backend.
service String? Service identifier returned by the API (e.g. liveness_check).
httpStatusCode int? HTTP status code from the SmartVerify API.
errorCode SmartVerifyErrorCode? Categorized SDK error code when isSuccess is false.
capturedImageBytes Uint8List? Locally captured JPEG bytes (when includeCapturedImage: true).
capturedImageBase64 String? Locally captured Base64 image (when includeCapturedImage: true).

Documentation #

For full SmartVerifyNG API and webhook documentation, visit: https://smartverifyng.com/docs#liveness-check

2
likes
0
points
246
downloads

Documentation

Documentation

Publisher

unverified uploader

Weekly Downloads

Flutter biometric facial capture and anti-spoofing liveness verification SDK for SmartVerifyNG. Guides users through on-device liveness checks and validates captured faces against the SmartVerify liveness API.

Homepage

Topics

#biometric #liveness #kyc #face-detection #verification

License

unknown (license)

Dependencies

camera, flutter, flutter_tts, google_mlkit_face_detection, http, image

More

Packages that depend on smartverify_biometric