FaceLiveness
Importing SDK
To use Sdk, you can either remotely import the .js
file or download it locally.
Remotely
Include the .js
file directly from the CDN:
You can retrieve the class from the SDK using the following code:
Initialization
initializeSdk(token: string, sdkContainer: string, useFaceAuthenticator: boolean, personId: string, options: any)
initializeSdk(token: string, sdkContainer: string, useFaceAuthenticator: boolean, personId: string, options: any)
The SDK has an isolated initialization method, to allow greater control over when it occurs.
During this process, the SDK will initialize its internal variables and download the resources it needs to run.
[!]You must call this method before using other SDK methods.
Supported Parameters
Parameter | Required? |
---|---|
Authentication token for consuming the SDK. | Yes. |
Id of the container where the SDK will be inserted. | Yes. |
Flag indicating whether to use FaceAuthenticator. | No. The default is |
Document number used as a unique identifier for each user. | Yes. |
Customizing the expiration time of the image Url returned by Sdk. | No. The default is 30 minutes, the accepted values are |
Image capture filter customization. | No. The default is |
Language customization. | No. The default is |
Customize the camera permission button text. | No. |
Customize the camera permission button text color. | No. |
Customize camera permission button background color. | No. |
Customize camera permission button border radius. | No. |
Customize camera permission button border. | No. |
Customize sdk start button text. | No. |
Customize sdk start button text color. | No. |
Customize sdk start button background color. | No. |
Customize sdk start button border radius. | No. |
Customize sdk start button border. | No. |
Example
Filter
Filter configuration for camera preview. It can be classic
, shaded
(additional detail, the default), vibrant
(full color), clear
(no filter) and blur
(starts blurred).
Language
Through the language
parameter, the application language can be changed, the default value is pt_BR
, check the availability below:
Parameter | Language |
| Welsh. |
| German. |
| English. |
| Spanish. |
| French. |
| Italian. |
| Dutch. |
| Portuguese. |
Iframe
To perform integration through an iframe, camera and fullscreen permissions must be provided.
Webview
To use the SDK through a Webview, camera permission must be granted in your native application.
Example implementation on Android.
AndroidManifest.xml
MainActivity
Sample android project for webview implementation, in addition it is necessary to be able to open the application in full screen, the example shows how to configure it correctly.
On IOS, camera and notion permissions must be granted with NSCameraUsageDescription
and NSMotionUsageDescription
according to the example project.
Opening and taking selfies
execute()
execute()
The method used to load the SDK onto the screen and perform selfie capture.
It will initialize the video stream (requesting permissions if needed) and load it into the container.
Example
Return
Field | Type | Description |
|
| 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. |
Example
Signed response params
Event | Description |
| Request identifier. |
| Validation of a living person, identifies whether the user passed successfully or not. |
| Request token. |
| User identifier provided for the request. |
| Temporary link to the image, generated by our API. |
| User identifier provided for the SDK. |
| Sdk version in use. |
| 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.
Events
Currently the SDK emits three types of events:
Event | Description |
| Capture stream initialization. |
| SDK components have been loaded and ready to use. |
| Image capture was successful. |
| Image capture failed. |
| An error occurred during the capture process. |
| streaming started, full screen start. |
| End of streaming, closing full screen. |
| Capture flow cancellation. |
| Camera permission is requested. |
| Camera permission was denied. |
| Browser does not support Sdk. |
Error event details
The error event is of customEvent type, therefore, if you wish to obtain details regarding the reason for the error, you can consume the event.detail where you will find the following descriptions.
Detail | Description |
---|---|
unknown | Try again |
client_camera | There was an error getting video from the camera |
client_error | An unknown error occurred |
error_asset_fetch | Unable to fetch assets |
error_camera | The camera cannot be started for unknown reasons |
error_camera_in_use | The camera is already in use and cannot be accessed |
error_camera_not_supported | The camera resolution is too small |
error_camera_permission_denied | The user denied our camera permission request |
error_device_motion_denied | The user denied our device motion permission request |
error_device_motion_unsupported | Your device does not seem to fully report device motion |
error_fullscreen_change | Exited fullscreen without completing iProov |
error_invalid_token | The token is invalid |
error_network | Network error |
error_no_face_found | No face could be found |
error_not_supported | The device or integration isn't able to run the Web SDK |
error_server | An error occurred when communicating with iProov's servers |
error_token_timeout | The token was claimed too long after being created |
error_too_many_requests | The service is under high load and the user must try again |
error_user_timeout | The user started the claim but did not stream in time |
integration_unloaded | The SDK was unmounted from the DOM before it finished |
sdk_unsupported | The SDK has passed end of life and is no longer supported |
Example error event listener
Last updated