PassiveFaceLiveness(Deprecated)

Privacy Policy and Terms & Conditions of Use

When using our plugin, please make sure that you agree with our Privacy Policy and our Terms and Conditions of Use.

Pre-requirements

If you use Dart in a version below 2.12, check the compatible version here.

Settings

Android

In the file ROOT_PROJECT/android/app/build.gradle, add:

android {

    ...
    
    dataBinding.enabled = true
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

//To perform layout customization from the SDK import the following libraries
dependencies {
    implementation "androidx.camera:camera-view:1.2.1"
    //native Android SDK that the plugin implements
    implementation 'com.combateafraude.sdk:passive-face-liveness:6.0.0-rc06'

    //design libraries that you will use in your layout (these are used in our example template for customization)
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
}

iOS

In the ROOT_PROJECT/ios/Podfile, add to the end of the file:

source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/' # or 'https://github.com/CocoaPods/Specs' if CDN is down

Finally, add the camera permission to the file ROOT_PROJECT/ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>To capture the selfie</string>

To enable text and voice in Portuguese, in your project, in the ROOTPROJECT/ios directory, open the .xcworkspace file in Xcode and add in Project > Info > Localizations the language Portuguese (Brazil).

Flutter

Add the plugin to your ROOT_PROJECT/pubspec.yaml file:

Stable


    dependencies:
        passive_face_liveness:
            git:
                url: https://github.com/combateafraude/Flutter.git
                ref: passive-face-liveness-v4.30.0

Release Candidate

dependencies:
    passive_face_liveness:
        git:
            url: https://github.com/combateafraude/Flutter.git
                ref: passive-face-liveness-v5.0.0-rc06

Utilization

PassiveFaceLiveness passiveFaceLiveness = new PassiveFaceLiveness(mobileToken: mobileToken);

// Other customization parameters

PassiveFaceLivenessResult passiveFaceLivenessResult = await passiveFaceLiveness.start();

if (passiveFaceLivenessResult is PassiveFaceLivenessSuccess) {
    // The SDK was successfully closed and the selfie was captured
} else if (passiveFaceLivenessResult is PassiveFaceLivenessFailure) {
    // The SDK was closed due to some failure and the selfie was not captured
} else {
    // The user simply closed the SDK, with no result
}

Disabling Security Validations for Testing

We are constantly taking actions to make the product more and more secure, mitigating a number of attacks observed in the capture process and, consequently, reducing as many possible identity frauds as possible. The SDK has some blocks that may prevent its execution in certain contexts. To disable them, you can use the methods as shown in the example below:

PassiveFaceLivenessAndroidSettings androidSettings =
    PassiveFaceLivenessAndroidSettings(
        emulatorSettings: true,
        rootSettings: true,
        useDeveloperMode: true,
        useAdb: true,
        useDebug: true,
    );
passiveFaceLiveness.setAndroidSettings(androidSettings);

Attention! Disabling security validations is recommended for test environments only. For publishing your application in production, we recommend using the default settings.

General customizations

Each environment (beta and production) requires its own specific mobileToken, generated in the Trust platform of the respective environment.

Example of use

PreviewSettings previewSettings = new PreviewSettings(
    show: true,
    title: "Is the photo good?",
    subTitle: "See if the photo is sharp",
    confirmLabel: "Yes, it's good!",
    retryLabel: "Take it again");
passiveFaceLiveness.setPreviewSettings(previewSettings);

Example of use

MessageSettings messageSettings = new MessageSettings(
    stepName: "Example message",
    faceNotFoundMessage: "Example message",
    faceTooFarMessage: "Example message",
    faceTooCloseMessage: "Example message",
    faceNotFittedMessage: "Example message",
    multipleFaceDetectedMessage: "Example message",
    verifyingLivenessMessage: "Example message",
    holdItMessage: "Example message",
    invalidFaceMessage: "Example message");
passiveFaceLiveness.setMessageSettings(messageSettings);

Android

iOS

Collecting the result

The PassiveFaceLiveness return object is of abstract type PassiveFaceLivenessResult. It can be an instance of PassiveFaceLivenessSuccess, PassiveFaceLivenessFailure, or PassiveFaceLivenessClosed.

PassiveFaceLivenessSuccess

PassiveFaceLivenessFailure

The existing fault types are:

  • InvalidTokenReason: when the token entered is invalid. It should not occur in a production environment;

  • PermissionReason: when some mandatory permission was not granted by the user. It will only occur in a production environment if your app does not ask the user or the user manually disables it before starting;

  • NetworkReason: server connection failure. It will occur in production if the user's device is not connected to the Internet;

  • ServerReason: failure in some request to our servers.

  • SecurityReason: when the device is not safe to run the SDK.

  • StorageReason: when the device does not have enough space to capture a photo. This can happen in production;

  • LibraryReason: when some internal failure made it impossible to run the SDK. It may occur due to configuration errors in the project, and should not occur in production;

Customizing iOS view

For iOS customization, it is required that the Flutter plugins are added locally to the project. The customization is performed natively with the ViewCode approach.

****Click here **** and access the example with a guide to using this feature.

Last updated

Logo

2023 © Caf. - All rights reserved