NewFaceLiveness - Flutter Plugin

Políticas de privacidade e termos e condições de uso

Ao utilizar nosso plugin, certifique-se que você concorda com nossas Políticas de privacidade e nossos Termos e condições de uso.

Pré requisitos

Configuração mínima Versão
Flutter 1.12+
Dart 2.12+
Android API 21+
iOS 11.0+

Configurações

Android

No arquivo ROOT_PROJECT/android/app/build.gradle, adicione:

android {

    ...

    dataBinding.enabled = true

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    rootProject.allprojects {
    repositories {
        maven { url "https://repo.combateafraude.com/android/release" }
        maven { url 'https://raw.githubusercontent.com/iProov/android/master/maven/' }
    }
}
}

iOS

No arquivo ROOT_PROJECT/ios/Podfile, adicione no final do arquivo:

source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/' # ou 'https://github.com/CocoaPods/Specs' se o CDN estiver fora do ar

Por último, adicione a permissão de câmera no arquivo ROOT_PROJECT/ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>To capture the selfie</string>

Utilização

PassiveFaceLiveness passiveFaceLiveness = new PassiveFaceLiveness(mobileToken: mobileToken, personId: 'CPF');

// Your SDK customization parameters

PassiveFaceLivenessResult passiveFaceLivenessResult = await passiveFaceLiveness.start();

if (passiveFaceLivenessResult is PassiveFaceLivenessSuccess) {
  // SDK finished with success, selfie picture registered
} else if (passiveFaceLivenessResult is PassiveFaceLivenessFailure) {
  // SDK finished with failure and selfie picture not registered
} else if (passiveFaceLivenessResult is PassiveFaceLivenessClosed) {
  // User closed the SDK
}

PassiveFaceLiveness methods

Parameter Required

.setStage(String stage)

Used to redirect the SDK to the desired environment in caf api.

No

.setFilter(String filter)

Used to change the SDK camera filter. It has the following options: CameraFilter.NATURAL or CameraFilter.LINE_DRAWING

No, the default is CameraFilter.LINE_DRAWING

.setEnableScreenshots(bool enable)

Used to enable screenshots during the SDK scan.

No, the default is false

Enums

CafStage

Description Values
Used to set the SDK stage on .setStage(String stage) method. CafStage.PROD, CafStage.BETA

CameraFilter

Description Values
Used to set the SDK's camera filter CameraFilter.NATURAL, CameraFilter.LINE_DRAWING

PassiveFaceLivenessSuccess

Field
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.

PassiveFaceLivenessFailure

iOS

The PassiveFaceLivenessFailure object return the following parameters.

Field
String signedResponse

Signed response from the CAF server confirming that the captured selfie has a real face.
String errorType

Error type returned by the SDK. Check the table below.
String errorMessage

Error message returned by the SDK.
String code

Error code returned by the SDK. Check the table below.

In case of failure, the PassiveFaceLivenessFailure object will also return a signedResponse containing information. Within the signedResponse, the parameter isAlive defines the execution of liveness, where true is approved and false is rejected.

Code Error Type Description
1 unknown Try aganin
2 getToken Error while trying to capture the execution token.
3 livenessError Error while attempting to execute liveness due to communication issues.
4 registerError Error while performing the registration of the liveness execution.
5 captureAlreadyActive An existing capture is already in progress. Wait until the current capture completes before starting a new one.
6 cameraPermissionDenied The user disallowed access to the camera when prompted. You should direct the user to re-try.
7 networkError An error occurred with the video streaming process. The associated string (if available) will contain further information about the error.
8 serverError A server-side error/token invalidation occurred. The associated string (if available) will contain further information about the error.
9 unexpectedError An unexpected and unrecoverable error has occurred. The associated string will contain further information about the error. These errors should be reported to iProov for further investigation.

Android

The PassiveFaceLivenessFailure object return the following parameters.

Field
String errorType

Error type returned by the SDK. NetworkReason or ServerReason.
String errorMessage

Error message returned by the SDK.
String code

Error code returned by the SDK.