FaceAuthenticator (Deprecated)
Last updated
Last updated
2023 © Caf. - All rights reserved
When using our plugin, please make sure that you agree with our Privacy Policy and our Terms and Conditions of Use.
If you use Dart in a version below 2.12, check the compatible version here.
In the file ** ROOT_PROJECT/android/app/build.gradle
**, add:
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
:
Add the plugin to your ROOT_PROJECT/pubspec.yaml
file:
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.
|
.setStage(String stage)
Allows you to choose the environment in wich the SDK will run (production or beta). The expected String
values are: "PROD" and "BETA". This setting is not mandatory, by default the SDK will use the production environment.
Each environment (beta and production) requires its own specific mobileToken, generated in the Trust platform of the respective environment.
|
The FaceAuthenticator return object is of abstract type FaceAuthenticatorResult
. It can be an instance of FaceAuthenticatorSuccess
, FaceAuthenticatorFailure
, or FaceAuthenticatorClosed
.
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 project configuration errors, and should not occur in production.
Minimum configuration
Version
Flutter
1.12+
Dart
2.12+
Minimum Android API
21+
Compile SDK Version
33
iOS
11.0+
FaceAuthenticator
.setPeopleId(String peopleId)
CPF of the user that will authenticate
.setAudioSettings(bool enable, String audioResIdName)
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 ROOT_PROJECT/android/app/src/main/res/raw/
with the desired name below and parameterize it
.setAnalyticsSettings(bool useAnalytics)
Enables/disables data collection for maximizing anti-fraud information. Default is true
.setNetworkSettings(int requestTimeout)
Change the default network settings. Default is 60
seconds
.setAndroidSettings(FaceAuthenticatorAndroidSettings androidSettings)
Customizations only applied on Android
.setIosSettings(FaceAuthenticatorIosSettings iosSettings)
Customizations only applied on iOS
.setEyesClosedSettings(bool enable, double threshold)
Lets you customize the eyes-open validation in the SDK
FaceAuthenticatorAndroidSettings constructor
FaceAuthenticatorCustomizationAndroid customization
Activity's Android layout customization
CaptureSettings captureSettings
Stabilization time settings for capturing the selfie
SensorSettingsAndroid sensorSettings
Customization of the capture sensor settings
bool enableEmulator
Enables the use of an emulator when true
bool enableRootDevices
Enables the use of root devices when true
bool enableSwitchCameraButton
Allows you to enable or disable the camera flip button. Default is True
bool enableBrightnessIncrease
Enables/disables device brightness increment on opening the SDK
bool useDebug
Enables/disables the use of the app in debug mode. Default is false
FaceAuthenticatorCustomizationAndroid 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 layout resource 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". Check the import libraries mentioned here
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".
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 the name R.string.my_custom_stability_string
and value "Test" and parametrize "my_custom_stability_string".
int stabilityStabledMillis
How many milliseconds the mobile 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².
FaceAuthenticatorIosSettings constructor
FaceAuthenticatorCustomizationIos customization
Customização visual do SDK
int beforePictureMillis
Duration in milliseconds between the first detection of the face and the actual capture of the picture
SensorStabilitySettingsIos sensorStability
Stability sensor settings to be applied in the SDK
FaceAuthenticatorCustomizationIos constructor
String colorHex
The SDK's 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's 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².
Field
bool authenticated
Flag indicating whether the user has passed face authentication
String signedResponse
Signed response from the CAF server that confirmed the face authentication. 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
String trackingId
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 useAnalytics = false
or the analytics calls do not work
Field
String message
Friendly message explaining why the SDK failed
String type
Type of fault that shut down the SDK