Ask or search…
K
Links
Comment on page

FaceLiveness

Runtime permissions

Permission
Reason
Required
CAMERA
Capturing the selfie in policies with facial re-authentication
Yes

Before Instantiating

Before Instantiating the SDK, in this specific version, we sdk you to come back and add other of our maven repository inside the dependencyResolutionManagement method in the settings.gradle file:
dependencyResolutionManagement {
repositories {
...
//Your maven should be like this
maven { url 'https://raw.githubusercontent.com/iProov/android/master/maven/' }
maven { url 'https://repo.combateafraude.com/android/release' }
}r
}

Instantiating the SDK

First, create an object of type FaceLiveness. This object is for you to configure all your business rules:
FaceLiveness faceLiveness = new FaceLiveness.Builder(String mobileToken)
//see table below
.build();

Builder method

Parameter
Required
String mobileToken
Usage token associated with your Identity account (see how to get it here).
Yes
.setStage(CAFStage stage)
Used to redirect the SDK to the desired stage in caf api. The method takes as parameter an enum CafStage to select the environment:
No. The default is CAFStage.PROD
Enum
Description
CAFStage.PROD
production environment.
CAFStage.BETA
beta environment.
.setFilter(Filter filter)
Used to change the SDK filter, that has the following options:
  • Filter.NATURAL
  • Filter.LINE_DRAWING
No, the default is LINE_DRAWING
.setEnableScreenshots(boolean bool)
Used to enable screenshots during the SDK scan. Disabled by default for security reasons.
No, the default is false
.setLoadingScreen(boolean bool)
Used to enable a default loading progressbar during loading events. You can set your customized loading screen instead, using the onLoading method below.
No, the default is false
.setImageUrlExpirationTime(Time time)
Used to customize the image URL expiration time, that has the following options:
  • Time.THREE_HOURS
  • Time.THIRTY_DAYS
No, the default is null

Consulting a policy

To authenticate a user, use the startSDK() method. You must enter the user's CPF, your app's Context and a VerifyLivenessListener object.

Parameters

Parameter
Required
String personId
User CPF
Yes
Context context
Your app Context
Yes
VerifyLivenessListener listener
Response Listener
Yes

Example

faceLiveness.startSDK(Context context, String personId, new VerifyLivenessListener() {
@Override
public void onSuccess(FaceLivenessResult faceLivenessResult) {
}
@Override
public void onError(FaceLivenessResult faceLivenessResult) {
}
@Override
public void onCancel(FaceLivenessResult faceLivenessResult) {
}
@Override
public void onLoading() {
}
@Override
public void onLoaded() {
}
});

VerifyLivenessListener options

Method
Description
onSuccess
The execution has ended with success, you have to use the faceLivenessResult and check for the results of the SDK.
onError
The execution has ended with error, you have to use the faceLivenessResult and check for the error results of the SDK.
onCancel
The execution has been cancelled by the user.
onLoading
The SDK is loading, you can use this method to set a action in your app, for example a loading.
onLoaded
The SDK is not loading anymore, you can use this method to set a action in your app, for example, you can stop your previous loading.

FaceLivenessResult

Success

Return
Reason
String signedResponse
Signed response from the CAF server confirming that the captured selfie has a real face. This parameter is used to get an extra layer of security, checking that the signature of the response is not broken, or caused by request interception. If it is broken, there is a strong indication of request interception.

Signed response params

Event
Description
requestId
Request identifier.
isAlive
Validation of a living person, identifies whether the user passed successfully or not.
token
Request token.
userId
User identifier provided for the request.
imageUrl
Temporary link to the image, generated by our API.
personId
User identifier provided for the SDK.
sdkVersion
Sdk version in use.
iat
Token expiration.
The isAlive parameter is VERY IMPORTANT, based on it validation must be carried out to continue with the flow or not, in case of isAlive: true, your user is able to continue with the journey, in case of isAlive: false, this user is not is valid and should be barred from the remainder of the journey.

Error

Return
Reason
String errorMessage
In case of any error, return the error.

SDKFailure

Return
Reason
SDKFailure sdkFailure
In case of a CAF SDK specific error, return the instance of the error.
InstanceOf
Description
Example
Methods
NetworkReason
Network error
The user's internet disabled
.getMessage()
.getThrowable()
ServerReason
When a SDK request receives a status code of failure
In theory, it shouldn't happen. If you see something like this, let us know!
.getMessage()
.getCode()
Last modified 3d ago