PassiveFaceLiveness (Deprecated)

Plugin that calls native SDKs in Android and iOS. If you have any questions, please send an email to our Head of Mobile

Importing

import {PassiveFaceLiveness} from 'passive-face-liveness-plugin';

Using

let passiveFaceLiveness = new PassiveFaceLiveness();
passiveFaceLiveness.setMobileToken = '<your mobile token>';

const response = passiveFaceLiveness.start();

if(response.result == "SUCCESS"){
    // Success
}else if(response.result == "FAILURE"){
    // Failure. Check reponse.type and response.message
}else{
    // User closed the screen
}

General customizations

PassiveFaceLiveness

.setPeopleId(String peopleId)

CPF of the user who is using the plugin to be used for fraud detection via analytics

..setUseAnalytics(bool useAnalytics)

Enables/disables data collection for maximizing anti-fraud information. Default is true

..setSound(bool enable)

Enables/disables sounds. Default is true

.setNetworkSettings(int requestTimeout)

Changes the default network settings. The default is 60 seconds

..setShowPreview(ShowPreview showPreview)

Preview for checking photo quality

.setAndroidSettings(PassiveFaceLivenessAndroidSettings androidSettings)

Customizations only applied on Android

.setIosSettings(PassiveFaceLivenessIosSettings iosSettings)

Customizations only applied on iOS

ShowPreview

If you want to customize the values, create a String in ROOT_PROJECT/android/app/src/main/res/values/strings.xml with the desired name and value and parameterize

bool show

Preview Enable/Disable

String title

Title

String subTitle

subtitle

String confirmLabel

Texto do botĆ£o de confirmaĆ§Ć£o

String retryLabel

Retrieve Capture Button Text

Android

PassiveFaceLivenessAndroidSettings constructor

PassiveFaceLivenessCustomizationAndroid customization

Customization of the activity's Android layout

CaptureSettings captureSettings

Stabilization time settings for capturing the selfie

SensorSettingsAndroid sensorSettings

Customization of the capture sensor settings

int showButtonTime

Changes the time for displaying the manual capture button. The default is 20000 milliseconds

PassiveFaceLivenessCustomizationAndroid constructor

String styleResIdName

Name of the style resource that defines the colors of the SDK. For example, if you want to change the SDK colors, create a style in ROOT_PROJECT/android/app/src/main/res/values/styles.xml with the name R.style.my_custom_style following the template and parameterize "my_custom_style".

String layoutResIdName

Name of the resource layout that will replace the default SDK layout. For example, if you want to change the SDK layout, create a layout in ROOT_PROJECT/android/app/src/main/res/layout/my_custom_layout.xml following the template and parameterize "my_custom_layout".

String greenMaskResIdName

Name of the drawable resource to replace the default green mask. If you are going to use this parameter, use a mask with the same cutting area, it is important for the detection algorithm. For example, save the mask image in ROOT_PROJECT/android/app/src/main/res/drawable/my_custom_green_mask.png and parameterize "my_custom_green_mask".

String redMaskResIdName

Name of the drawable resource to replace the default red mask. If you are going to use this parameter, use a mask with the same cutting area, it is important for the detection algorithm. For example, save the mask image in ROOT_PROJECT/android/app/src/main/res/drawable/my_custom_red_mask.png and parameterize "my_custom_red_mask".

String whiteMaskResIdName

Name of the drawable resource to replace the default white mask. If you are going to use this parameter, use a mask with the same cutting area, it is important for the detection algorithm. For example, save the mask image in ROOT_PROJECT/android/app/src/main/res/drawable/my_custom_white_mask.png and parameterize "my_custom_white_mask".

CaptureSettings constructor

int beforePictureMillis

Duration in milliseconds between the first face detection and the actual photo capture

int afterPictureMillis

Duration in milliseconds between capturing the photo and sending it to the server to keep the face and sensors valid

SensorSettingsAndroid constructor

SensorStabilitySettingsAndroid sensorStabilitySettings

Orientation sensor settings to be applied in all SDK steps

SensorStabilitySettingsAndroid constructor

String messageResourceIdName

Name of the string resource to be shown when the phone is not stable. The default message is "Keep cell phone still". For example, if you want to show the String "Test", create a String in ROOT_PROJECT/android/app/src/main/res/values/strings.xml with name R.string.my_custom_stability_string and value "Test" and parametrize "my_custom_stability_string".

int stabilityStabledMillis

How many milliseconds the cell phone must stay at the correct threshold to be considered stable. The default is 2000 ms

double stabilityThreshold

Lower threshold between stable/unstable, in m/sĀ² variation between the last two sensor collections. The default is 0.5 m/sĀ².

iOS

PassiveFaceLivenessIosSettings constructor

PassiveFaceLivenessCustomizationIos customization

SDK visual customization

int beforePictureMillis

Duration in milliseconds between the first face detection and the actual photo capture

SensorStabilitySettingsIos sensorStability

Stability sensor settings to be applied in the SDK

PassiveFaceLivenessCustomizationIos constructor

String colorHex

SDK theme color. For example, if you want to use the color black, use "#000000".

String greenMaskImageName

Name of the image to replace the default green mask. Remember to add the image in Assets Catalog Document in your XCode project

String whiteMaskImageName

Name of the image to replace the default white mask. Remember to add the image in Assets Catalog Document in your XCode project

String redMaskImageName

Name of the image to replace the default red mask. Remember to add the image in Assets Catalog Document in your XCode project

String closeImageName

Name of the image to replace the SDK close button. Remember to add the image in Assets Catalog Document in your XCode project

bool showStepLabel

Flag indicating whether to show the label of the current step

bool showStatusLabel

Flag indicating whether to show the current status label

SensorStabilitySettingsAndroid constructor

String message

String to be shown when the cell phone is not stable

double stabilityThreshold

Lower threshold between stable/unstable, in m/sĀ² variation between the last two sensor collections. The default is 0.3 m/sĀ².

Collecting the result

The DocumentDetector return object will have the result attribute that contains a string SUCCESS, FAILURE or CLOSED. The return will default to PassiveFaceLivenessSuccess, PassiveFaceLivenessFailure and PassiveFaceLivenessClosed, respectively, for each of the cases.

PassiveFaceLivenessSuccess

Field

String imagePath

Full address of the image on the device

String imageUrl

URL of the image temporarily stored on CAF servers

String signedResponse

Signed response from the CAF server which confirmed that the captured selfie has a real face (not a photo or video). Use this parameter if you want an extra layer of security by checking that the signature of the response is not broken, caused by an intercepted request. If it is broken, there is a strong indication of request interception

String trackingId

Identifier of this execution on our servers. If possible, save this field and send it along to our API. This will give us more data about how the user behaved during the execution

Will be null if the user sets useAnalytics = false or the analytics calls do not work

PassiveFaceLivenessFailure

Field

String message

Friendly message explaining why the SDK failed

String type

Fault type that shut down the SDK

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 happen in a production environment if your app does not ask your user or the user manually disables it before starting;

  • NetworkReason: server connection failure. Will occur in production if the user's device is without internet;

  • ServerReason: failure in some request with our servers. It will occur in production only in case of our failure;

  • SecurityReason: when the device is not safe to run the SDK. If this failure occurs, let us know;

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

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

PassiveFaceLivenessClosed

Empty object indicating closure of the capture screen by the user.

Last updated

Logo

2023 Ā© Caf. - All rights reserved