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
Minimum configuration | Version |
Flutter | 1.12+ |
Dart | 2.12+ |
Minimum Android API | 21+ |
Compile SDK Version | 33 |
iOS | 11.0+ |
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:
iOS
In the ROOT_PROJECT/ios/Podfile
, add to the end of the file:
Finally, add the camera permission to the file ROOT_PROJECT/ios/Runner/Info.plist
:
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
Release Candidate
Utilization
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:
Attention! Disabling security validations is recommended for test environments only. For publishing your application in production, we recommend using the default settings.
General customizations
PassiveFaceLiveness |
CPF of the user who is using the plugin to be used for fraud detection via analytics |
Binds a proof-of-life attempt to a name |
Binds a proof-of-life attempt to a cpf |
Enables/disables data collection for maximizing anti-fraud information. Default is true |
Enables/disables sounds. Allows you to customize the audio used by the SDK. If you want to change the SDK's audio, add the audio file in |
|
Preview for photo quality check |
Sets the capture settings |
Sets how long the image URL will last on the server until it is expired. Expect to receive a time interval between "30m" to "30d". The default is |
Allows you to customize the messages displayed in the "status" balloon during the capture and analysis process |
Delay the activity after each step is finished. This method can be used to display a success message on the screen itself after the capture, for example. Default is |
Customizations only applied on Android |
Customizations only applied on iOS |
Lets you customize the eyes-open validation in the SDK |
Allows you to customize the message displayed when a processing problem or error occurs in the API response. |
Allows you to choose the environment in wich the SDK will run (production or beta). The expected |
Each environment (beta and production) requires its own specific mobileToken, generated in the Trust platform of the respective environment.
ImageCapture constructor |
Enables/disables the capture of a frame. Default is |
Duration in milliseconds between the first detection of the face and the actual capture of the picture. The default is 0 ms |
Duration in milliseconds between capturing the picture and sending it to the server to keep the face and sensors valid. The default is 2000 ms |
VideoCapture constructor |
Enables/disables video capture. Default is |
This sets the time of the video that will be captured. The default is 3s |
PreviewSettings |
Enable/Disable preview |
Title |
Subtitle |
Text of the confirmation button |
Text of the retry button |
Example of use
MessageSettings |
Default: "Registro Facial" |
Default: "Segure assim" |
Default: "Não encontramos nenhum rosto" |
Default: "Aproxime o rosto" |
Default: "Afaste o rosto" |
Default: "Encaixe seu rosto" |
Default: "Mais de um rosto detectado" |
Default: "Verificando selfie…" |
Default: "Ops, rosto inválido. Por favor, tente novamente" |
Default: "Mantenha o celular parado" |
Default: "Ops, tivemos um problema ao processar sua imagem. Tente novamente." |
Default: "Mais de um rosto detectado" |
Default: "Celular não está na vertical" |
Default: "Seus olhos estão fechados" |
Default: "Centralize seu rosto na vertical" |
Default: "Centralize seu rosto na horizontal" |
Default: "Seu rosto não está ajustado à máscara" |
Example of use
Android
PassiveFaceLivenessAndroidSettings constructor |
Customization of the Android layout of the activity |
Customization of the capture sensor settings |
Changes the time for the display of the manual capturing button. The default is |
Allows you to enable or disable the camera flip button. Default is |
Allows you to enable/disable SDK features that consume GoogleServices in the SDK, we do not recommend disabling the services because of security loss. Default is |
Allows you to enable/disable the use of emulated devices in the SDK. We recommend disabling the use of emulators for security reasons. Default is |
Allows you to enable/disable the use of root devices in the SDK. We recommend disabling the use of these devices for security reasons. Default is |
Allows you to enable/disable the use of devices with Android developer mode enabled. We recommend disabling the use of these devices for security reasons. Default is |
Allows you to enable/disable the use of the Android Debug Bridge (ADB) debug mode. We recommend disabling the use of these devices for security reasons. Default is |
Enables/disables device brightness increment on opening the SDK |
PassiveFaceLivenessCustomizationAndroid constructor |
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 |
Name of the layout resource that will replace the default SDK layout. For example, if you want to change the SDK layout, create a layout in |
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 |
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 |
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 |
Defines the type of mask used in the captures. There are two types: |
SensorSettingsAndroid constructor |
Stability sensor settings to be applied in all SDK steps |
Orientation sensor settings to be applied in all SDK steps |
SensorStabilitySettingsAndroid constructor |
How many milliseconds the mobile must stay at the correct threshold to be considered stable. The default is |
Stable/unstable threshold, in m/s² variation between the last two sensor collections. The default is |
SensorOrientationAndroid constructor |
Stable/unstable threshold, in m/s² variation between the last two sensor collections. The default is |
iOS
PassiveFaceLivenessIosSettings constructor |
SDK visual customization |
Duration in milliseconds between the first detection of the face and the actual capture of the picture |
Stability sensor settings to be applied in the SDK |
Enables manual capture mode |
Sets time (in seconds) to display manual capture button |
Allows you to set the quality in the compression process. By default all captures are compressed. The method expects values between 0 and 1.0 as a parameter, 1.0 being the best quality compression (recommended).The default is 1.0 |
Allows setting the capture resolution. The method takes as parameter a |
Resolution | Description |
| Specifies appropriate capture settings for output video and audio bit rates suitable for 3G sharing |
| Specifies the appropriate capture settings for the output video and audio bitrates suitable for sharing over WiFi |
| Specifies appropriate capture settings for high-quality video and audio output |
| Specifies appropriate capture settings for high-resolution photo quality output |
| Specifies appropriate capture settings for high-resolution photo quality output |
| Specifies the appropriate capture settings for video output at 720p quality (1280 x 720 pixels) |
| Capture settings suitable for 1080p (1920 x 1080 pixels) quality video output |
| Capture settings suitable for 2160p (3840 x 2160 pixels) quality video output |
PassiveFaceLivenessCustomizationIos constructor |
The SDK's theme color. For example, if you want to use the color black, use "#000000". |
Name of the image to replace the default green mask. Remember to add the image in Assets Catalog Document in your XCode project |
Name of the image to replace the default white mask. Remember to add the image in |
Name of the image to replace the default red mask. Remember to add the image in |
Name of the image to replace the close button in the SDK. Remember to add the image in |
Flag indicating whether to show the label of the current step |
Flag indicating whether to show the current status label |
Value that sets the size of the "close" button in the SDK |
Attribute that defines the content mode of the "close" button in the SDK. Choose from these values. |
SensorStabilitySettingsIos constructor |
String to be shown when the cell phone is not stable |
Lower threshold between stable/unstable, in m/s² variation between the last two sensor collections. The default is |
Collecting the result
The PassiveFaceLiveness return object is of abstract type PassiveFaceLivenessResult
. It can be an instance of PassiveFaceLivenessSuccess
, PassiveFaceLivenessFailure
, or PassiveFaceLivenessClosed
.
PassiveFaceLivenessSuccess
Field | |
Full address of the image on the device | |
Full address of the video on the device. If the capture format is not video, the return is null | |
URL of the image temporarily stored in the CAF servers | |
Signed response from the CAF server that 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 interception of the request. If it is broken, there is a strong indication of request interception | |
Identifier of this run on our servers. If possible, save this field and send it along to our API. This way we will have more data about how the user behaved during the execution | Will be null if the user sets |
PassiveFaceLivenessFailure
Field |
Friendly message explaining why the SDK failed |
Type of fault 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 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