trustchex_flutter_sdk 1.332.3 copy "trustchex_flutter_sdk: ^1.332.3" to clipboard
trustchex_flutter_sdk: ^1.332.3 copied to clipboard

Identity verification and face authentication SDK with document scanning, liveness detection, NFC/eID reading, and biometric technology for Flutter apps.

Trustchex Flutter SDK #

Flutter SDK for identity verification and face authentication using biometric technology.

Features #

  • 📄 Document Scanning - Scan ID cards and passports with MRZ detection
  • 🔐 NFC/eID Reading - Read e-Passport chips for secure verification
  • 🎭 Liveness Detection - Active liveness checks with head pose challenges
  • 📊 Analytics - Built-in event tracking and funnel analytics
  • 🎨 Customizable - Full branding and theming support
  • 🌍 Localization - English and Turkish out of the box

Installation #

Add the SDK to your pubspec.yaml:

dependencies:
  trustchex_flutter_sdk: ^1.331.10

iOS Configuration #

Add the following keys to your ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required to scan documents and verify your identity</string>

<key>NFCReaderUsageDescription</key>
<string>NFC is required to read your passport chip</string>

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
  <string>A0000002471001</string>
</array>

Android Configuration #

Add the following to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.NFC" />

<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />

Set minimum SDK version in android/app/build.gradle:

android {
    defaultConfig {
        minSdkVersion 24
    }
}

Quick Start #

import 'package:trustchex_flutter_sdk/trustchex_flutter_sdk.dart';

// Basic usage
TrustchexView(
  sessionId: 'your-session-id',
  baseUrl: 'https://api.trustchex.com',
  onCompleted: () {
    print('Verification completed successfully!');
  },
  onError: (error) {
    print('Error: $error');
  },
)

Full Example #

import 'package:flutter/material.dart';
import 'package:trustchex_flutter_sdk/trustchex_flutter_sdk.dart';

class VerificationPage extends StatelessWidget {
  final String sessionId;

  const VerificationPage({required this.sessionId});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: TrustchexView(
        sessionId: sessionId,
        baseUrl: 'https://api.trustchex.com',
        branding: TrustchexBranding(
          primaryColor: Color(0xFF2196F3),
          secondaryColor: Color(0xFFBBDEFB),
          tertiaryColor: Color(0xFFF44336),
          logoUrl: 'https://example.com/logo.png',
        ),
        locale: TrustchexLocale.en,
        enableAnalytics: true,
        enableVoiceGuidance: true,
        onResult: (result) {
          if (result.isSuccess) {
            Navigator.of(context).pushReplacementNamed('/success');
          } else {
            Navigator.of(context).pop();
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(content: Text(result.message ?? 'Verification failed')),
            );
          }
        },
      ),
    );
  }
}
import 'package:trustchex_flutter_sdk/trustchex_sdk.dart';

void handleDeepLink(String url) {
  final parsed = DeeplinkUtils.parseDeepLink(url);
  
  if (parsed != null && parsed['sessionId'] != null) {
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => TrustchexView(
          sessionId: parsed['sessionId']!,
          baseUrl: parsed['baseUrl'] ?? 'https://api.trustchex.com',
        ),
      ),
    );
  }
}

Customization #

Branding #

TrustchexBranding(
  logoUrl: 'https://example.com/logo.png',
  primaryColor: Color(0xFF000000),
  secondaryColor: Color(0xFFCCCCCC),
  tertiaryColor: Color(0xFFFF0000),
  backgroundColor: Colors.white,
  textColor: Colors.black87,
  buttonTextColor: Colors.white,
  borderRadius: 12.0,
)

Localization #

The SDK supports English (TrustchexLocale.en) and Turkish (TrustchexLocale.tr) out of the box.

TrustchexView(
  sessionId: sessionId,
  baseUrl: baseUrl,
  locale: TrustchexLocale.tr, // Use Turkish
)

Analytics #

Track custom events alongside built-in SDK analytics:

// Access the analytics service
final analytics = AnalyticsService.instance;

// Track custom events
await analytics.trackButtonClick('custom_button', screenName: 'home');
await analytics.trackFunnelStep('checkout', stepNumber: 3);

Demo Mode #

The SDK includes a demo mode for testing and development purposes. In demo mode:

  • All verification steps can be skipped individually
  • No real API calls are made to the backend
  • Simulated data is used for all operations
  • Network delays are simulated for realistic testing

Enabling Demo Mode #

Set the isDemoMode flag when creating the session configuration:

TrustchexView(
  sessionId: 'demo-session-id',
  baseUrl: 'https://api.trustchex.com',
  isDemoMode: true, // Enable demo mode
  onResult: (result) {
    print('Demo verification completed');
  },
)

Alternatively, use the special demo session code DEMXCXDE:

TrustchexView(
  sessionId: 'DEMXCXDE', // Special demo code
  baseUrl: 'https://api.trustchex.com',
  // isDemoMode will be automatically set to true
)

Skip Functionality #

In demo mode, each verification step displays a "Skip This Step" button that allows you to:

  1. Contract Acceptance - Skip reading and accepting the consent agreement
  2. Document Scanning - Skip document capture and use simulated document data
  3. NFC/eID Scanning - Skip NFC chip reading (also available when NFC is not supported)
  4. Liveness Detection - Skip face verification and liveness checks

When you skip a step:

  • A confirmation dialog appears to prevent accidental skips
  • Simulated/fake data is automatically generated for that step
  • The workflow continues to the next step
  • All skipped steps are tracked in analytics (if enabled)

Demo Mode Workflow #

// Example: Testing the full flow with selective skipping
TrustchexView(
  sessionId: 'DEMXCXDE',
  baseUrl: 'https://api.trustchex.com',
  isDemoMode: true,
  onResult: (result) {
    // In demo mode, result will always be successful
    print('Demo completed: ${result.status}');
    print('Demo data: ${result.details}');
  },
)

Demo Mode vs Production #

Feature Demo Mode Production
API Calls Simulated Real
Skip Steps ✅ Allowed ❌ Not allowed (unless step is optional)
Data Validation Minimal Full
Network Delays Simulated Real
Analytics Optional Recommended
Session Code DEMXCXDE Real session ID

Important: Demo mode should only be used for development and testing. Never use demo mode in production applications.

Verification Result #

TrustchexView(
  onResult: (VerificationResult result) {
    print('Status: ${result.status}');
    print('Session ID: ${result.sessionId}');
    print('Identification ID: ${result.identificationId}');
    print('Message: ${result.message}');
    
    if (result.isSuccess) {
      // Handle success
    } else if (result.isFailed) {
      // Handle failure
    }
  },
)

Requirements #

  • Flutter 3.16.0+
  • Dart 3.0.0+
  • iOS 12.0+
  • Android API 24+

License #

See LICENSE for details.