caf_sdk 1.2.0
caf_sdk: ^1.2.0 copied to clipboard
A Flutter plugin that provides native integration with the CAF (Combate à Fraude) SDK.
CAF SDK Flutter Plugin #
A Flutter plugin that provides native integration with the CAF (Combate à Fraude) SDK, enabling document detection, face liveness verification, and related UI components in Flutter applications.
Features #
- Document Detector - Detect and validate identity documents
- Document Detector UI - Pre-built UI components for document capture
- Face Liveness - Verify face liveness for biometric authentication
- Face Liveness UI - Pre-built UI components for face capture
- Cross-platform - Native implementation for both Android and iOS
- Event-driven - Stream-based event handling for real-time updates
Example #
Check out the example app for a complete implementation example.
Installation #
- Install package:
flutter pub add caf_sdk
-
Configure platform-specific settings (see Platform Setup below)
-
Run the app:
flutter run
Platform Setup #
Android #
- Add Maven Repositories: Configure the project's
build.gradle.ktsfile (usually located at the root level):
repositories {
// Caf Repository
maven { url = uri("https://repo.combateafraude.com/android/release") }
// iProov Repository (required for Face Liveness)
maven { url = uri("https://raw.githubusercontent.com/iProov/android/master/maven/") }
// FingerPrintJS Repository
maven { setUrl("https://maven.fpregistry.io/releases") }
// JitPack
maven { setUrl("https://jitpack.io") }
}
- Permissions: Ensure the following permissions are added to
android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- Minimum SDK: Verify
android/app/build.gradle.ktshas:
android {
defaultConfig {
minSdk = 26
}
}
iOS #
- Add camera usage description to your
ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Allows access to the camera to capture document images.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allows access to stored files and images for processing, if necessary.</string>
<key>UILaunchStoryboardName</key>
- Ensure your iOS deployment target is at least 15.0 in
ios/Podfile:
platform :ios, '11.0'
Usage #
Basic Setup #
import 'package:caf_sdk/caf_sdk.dart';
final config = CafSdkConfiguration(
mobileToken: 'token',
personId: 'personId',
environment: CafEnvironment.dev,
configuration: CafSdkBuilderConfiguration(
presentationOrder: [
CafModuleType.faceLiveness,
CafModuleType.documentDetector,
],
waitForAllServices: true,
),
);
// Face Liveness Configuration
final faceLivenessConfig = CafFaceLivenessConfiguration(
configuration: CafFaceLivenessBuilderConfiguration(
loading: true,
debugModeEnabled: true,
),
);
// Document Detector Configuration
final documentDetectorConfig = CafDocumentDetectorConfiguration(
configuration: CafDocumentDetectorBuilderConfiguration(
flow: [
CafDocumentDetectorFlow(document: CafDocument.rgFront),
CafDocumentDetectorFlow(document: CafDocument.rgBack),
],
uploadSettings: CafDocumentDetectorUploadSettings(enable: false),
manualCaptureEnabled: false,
manualCaptureTime: 45,
showPopup: true,
previewShow: false,
securitySettings: CafDocumentDetectorSecuritySettings(
useAdb: true,
useDebug: true,
useDevelopmentMode: true,
),
),
);
await _cafSdk.initializeCafSdk(
cafSdkConfiguration: config,
faceLivenessConfiguration: faceLivenessConfig,
documentDetectorConfiguration: documentDetectorConfig,
);
Event Handling #
// Listen to SDK events
void _initializeEventStream() {
_eventSubscription = _cafSdk.eventStream.listen((event) {
if (!mounted) return;
print('Caf SDK Event: $event');
});
}
Configuration #
The plugin supports extensive configuration options for each module:
- CafSdkConfiguration - Main SDK configuration
- CafDocumentDetectorConfiguration - Document detection settings
- CafDocumentDetectorUIConfiguration - Document UI customization
- CafFaceLivenessConfiguration - Face liveness settings
- CafFaceLivenessUIConfiguration - Face UI customization
Refer to the API documentation for detailed configuration options.
Requirements #
- Flutter >= 3.3.0
- Dart ^3.9.0
- Android API level 26+
- iOS 11.0+
Support #
For support and questions:
- Check the example app for a complete implementation example.
- Review the SDK documentation
- Contact the development team for technical support
License #
This plugin is proprietary software. Please refer to the license terms for usage rights and restrictions.