Comment on page
FaceLiveness
When using our plugin, please make sure that you agree with our Privacy Policy and our Terms and Conditions of Use.
In the file
ROOT_PROJECT/android/app/build.gradle
, add:android {
...
dataBinding.enabled = true
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Import the package and call the method add() inside of the initialization in
android/app/src/main/java/io/ionic/starter/MainActivity.java
:
import com.passive.PassiveFaceLivenessPlugin;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(PassiveFaceLivenessPlugin.class);
}
}
In the
ROOT_PROJECT/ios/Podfile
, add to the end of the file:source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/' # or 'https://github.com/CocoaPods/Specs' if the CDN is down
Finally, add the camera permission to the file
ROOT_PROJECT/ios/Runner/Info.plist
:<key>NSCameraUsageDescription</key>
<string>To read the documents</string>
In the file
ROOT_PROJECT/package.json
add:"dependencies": {
"new-passive-face-liveness-plugin": "https://github.com/combateafraude/Ionic/archive/refs/tags/new-passive-face-liveness-v1.1.0.tar.gz"
}
Than, run:
- 1.npm install
- 2.ionic capacitor build < platform > [ options ]
import {PassiveFaceLiveness} from 'new-passive-face-liveness-plugin';
const faceLiveness = new PassiveFaceLiveness({mobileToken}, {personId});
const response = await faceLiveness.start();
if(response.result == "SUCCESS"){
// Sucesso
}else if(response.result == "FAILURE"){
// Falha. Confira reponse.type e response.message
}else{
// Usuário fechou a tela
}
O objeto de retorno do DocumentDetector terá o atributo
result
que contém uma string SUCCESS
, FAILURE
ou CLOSED
. O retorno terá o padrão PassiveFaceLivenessSuccess, PassiveFaceLivenessFailure e PassiveFaceLivenessClosed, respectivamente, para cada um dos casos.PassiveFaceLivenessSuccess
Return |
---|
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.PassiveFaceLivenessFailure
Return |
---|
String errorMessage
In case of error in the request, return the error. |
PassiveFaceLivenessClosed
Objeto vazio indicando fechamento da tela de captura pelo usuário.
Last modified 3d ago