Comment on page
FaceAuthenticator (Deprecated)
Facematch with proof of life from the user of your app, ideal for login flows or valuable financial transactions.
Our SDKs by default collect information about the user and running environment to better map fraudsters and understand their behaviors. We recommend keeping this collection active as the only purpose of this data is for fraud reduction, but if you wish, you can disable it by
.setAnalyticsSettings(boolean useAnalytics)
parameter.Permission | Reason | Required |
---|---|---|
CAMERA | To capture the user selfie | Yes |
First, create an object of type
FaceAuthenticator
. This object is for you to configure all your business rules for the SDK:FaceAuthenticator mFaceAuthenticator = new FaceAuthenticator.Builder(String mobileToken)
// see table below
.build();
All parameters annotated with@Nullable
can be givennull
values, useful if you want to set only one of the parameters of a single method.
Parameter | Required |
---|---|
String mobileToken Usage token associated with your CAF account. | Yes. |
.setPeopleId(String peopleId) User identifier to perform facematch. Currently, this value accepts only the user's CPF. | Yes. |
.setAnalyticsSettings(boolean useAnalytics) | No, the default is true |
.setStabilitySensorSettings(@Nullable SensorStabilitySettings sensorStabilitySettings) Changes the default settings of the stability sensor. Apply null if you don't want to use this sensor. | No. The default time is 1000 ms and the default threshold is 0.7 m/s². |
.setCaptureSettings(@Nullable CaptureSettings captureSettings) Defines the capture settings. The method accepts instances of the ImageCapture and VideoCapture classes. | No. The default is ImageCapture |
.setLayout(@Nullable @LayoutRes Integer layoutId) Replaces the default SDK layout. Create a file in your project's layout folder, copy this template and make the desired changes. | |
.setMask(@DrawableRes Integer greenMask, @DrawableRes Integer whiteMask, @DrawableRes Integer redMask) Changes the face capture masks: SUCCESS, NORMAL, and FAIL, in that order. If you use this option, use masks with the same detection area as the face, this region is very important for the algorithm to capture. | |
.setStyle(@StyleRes int styleResourceId) Replaces the SDK's default style. In your project's styles.xml file, copy this template and edit it. | |
.enableSwitchCameraButton(boolean enable) Enables/disables the button for the user to switch between the front and rear camera. | No. The default is true |
.setNetworkSettings(int requestTimeout) Sets the timeout interval for SDK requests. | No. The default is 60 (seconds) |
.enableGoogleServices(boolean enable) Allows you to enable/disable features of the SDK that consume GoogleServices in the SDK, we do not recommend disabling the services because of the loss of security. | No. The default is true |
.setUseEmulator(boolean use) Enables the use of emulators when true . When true , ADB mode is enabled together for the emulator to work correctly. It is not recommended to enable this option, use it for testing purposes only. | No. The default is false |
.setUseRoot(boolean use) Allows the use of root devices when true . | No. The default is false |
.setUseDeveloperMode(boolean use) Enables the use of developer mode when true . It is not recommended to enable this option, use it only for testing purposes. | No. The default is false |
.setUseAdb(boolean use) Enables Android Debug Bridge (ADB) debugging mode when true . It is not recommended to enable this option, use it only for testing purposes. | No. The default is false |
.setUseDebug(boolean use) Allows you to use the app in debug mode when true . It is not recommended to enable this option, use it only for testing purposes. | No. The default is false |
.setAudioSettings(boolean use) Enables/disables playback of SDK audios. | No. The default is true |
.setAudioSettings(Integer audioResId) It allows you to customize the audio used by the SDK. | No. The default is "Registro Facial". |
.enableBrightnessIncrease(boolean enable) Enables/disables the brightness increment of the device on opening the SDK. | No. The default is true |
.setEyesClosedSettings(boolean enable, double threshold) Allows you to customize the SDK's open-eye validation settings. The method expects as parameter enable to enable or disable validation, and threshold, value between 0.0 and 1.0Allows you to customize the SDK's open-eye validation settings. The method expects as parameter enable to enable or disable validation, and threshold , value between 0.0 and 1.0 | No. The default is true and 0.5 |
.setStage(CafStage stage) Allows you to choose the environment in wich the SDK will run (production, beta). The method takes as parameter an enum CafStage to select the environment: | No. The default is CafStage.PROD |
Enum | Description |
CafStage.PROD | Will use the Trust Platform production environment to register the SDK executions. |
CafStage.BETA | Will use the Trust Platform beta environment to register the SDK executions. |
Each environment (beta and production) requires its own specific mobileToken, generated in the Trust platform of the respective environment.
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:
FaceAuthenticator.Builder("mobileToken")
.setUseEmulator(true)
.setUseRoot(true)
.setUseDeveloperMode(true)
.setUseAdb(true)
.setUseDebug(true)
.build();
Disabling security validations is recommended for testing purposes only. For publishing your application in production, we recommend using the default settings.
After creating the
FaceAuthenticator
, start the FaceAuthenticatorActivity
by passing this object as a parameter via extra intent:Intent mIntent = new Intent(context, FaceAuthenticatorActivity.class);
mIntent.putExtra(FaceAuthenticator.PARAMETER_NAME, mFaceAuthenticator);
startActivityForResult(mIntent, REQUEST_CODE);
To get the
FaceAuthenticatorResult
object, which contains the captures taken by the SDK, override the onActivityResult
method in the same activity that you started the FaceAuthenticatorActivity
:@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK && data != null) {
FaceAuthenticatorResult mFaceAuthenticatorResult = (FaceAuthenticatorResult) data.getSerializableExtra(FaceAuthenticatorResult.PARAMETER_NAME);
// verifique mFaceAuthenticatorResult.getSDKFailure() para descobrir qual foi o motivo da finalização do SDK
} else {
// o usuário fechou a activity
}
}
super.onActivityResult(requestCode, resultCode, data);
}
Parameter | Allow null |
---|---|
boolean authenticated Flag that indicates whether the captured selfie passed face match with the photo stored on the CAF server and the respective CPF entered by the user. | No |
String signedResponse Signed response from the CAF server that performed the facematch. Use this parameter if you want an extra layer of security, checking that the signature of the response is not broken, or caused by an intercepted request. If it is broken, there is a strong indication of request interception. | Yes, in case of error |
String trackingId Identifier of this execution on our servers. If possible, save this field and send it along to our API. This way we will have more data on how the user behaved during the execution. | Yes, if the user sets useAnalytics = false or the analytics calls do not work |
Yes, in case of success | |
lensFacing: Int Defines the face of the camera that was used. Use FaceAuthenticatorResult.LENS_FACING_FRONT or FaceAuthenticatorResult.LENS_FACING_FRONT to validate. | No |
Last modified 4mo ago