FaceAuthenticator (Deprecated)
Importing SDK
To use FaceAuthenticator, 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:
Locally
Download the .js
file and import it as an ES6 module:
Construction
In the builder, the SDK receives a single parameter with the settings:
Supported parameters
Parameter | Required? |
Authentication token for consuming the SDK. | Yes. |
Default message language, valid values: en_US, en_BR, es_MX. | No. The default is |
Analytics Configuration Objects. | No. |
Parameter responsible for enabling or disabling analytics. | No. |
Unique id that we are going to save the information from this SDK execution. | No. |
We accept an information object. | No. |
Flag indicating whether execution on desktops should be blocked. | No. The default is |
Flag indicating whether advanced capture should be disabled*. | No. The default is |
Customization of the capture icon accepts values such as image URL or base64 SVGs. | No |
Customization of the icon size for the captureButtonIcon field. | No |
Customization of the default image capture button color. | No |
Customization of the camera switch icon accepts values such as image URL or base64 SVGs. | No |
Customization of the icon size for the switchButtonIcon field. | No |
Customization of the color of the default camera switching icon. | No |
Changes the font for all elements contained in the SDK. | No. The pattern is inherited from the page |
Customization of the image processing message. | No. The default is |
Customization of the capture failure message. | No. The default is |
* Advanced capture consists of using more complex and not-so-stable APIs in browsers that support them (e.g. ImageCapture)
Example
CaptureStage
CaptureStage allows the client to configure the stages. To do this, we offer the CaptureStage
object, where you can set the following parameters:
Parameter |
Desired capture mode. It can be used |
The number of attempts of the current stage. If it is the only stage, the value |
Duration time of the current stage. If more than one stage is set, the total time for each stage can be set, and when the total time is reached, the stage will move on to the next one. Set it to |
Example CaptureStage
Initialization
initialize(): Promise<void>
initialize(): Promise<void>
The SDK has a separate method of initialization, to allow greater control over when it occurs.
During this initialization, 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.
[!] The initialization of the SDK can take a few seconds. We recommend that you call this function as early as possible in your flow so that opening the SDK is smooth for the user.
Example
Utilization
Opening and taking selfies
capture(container: HTMLElement, stages, {personData?: PersonData, totalAttempts?: Number}): Promise<Result>
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.
Parameters
Parameter | Type |
CPF of the user doing the authentication (required). |
|
Name of the user doing the authentication (optional). |
|
¹ If not specified, automatic capture is used.
² If not specified, a default value of 30 seconds is used.
Example
Return
The return consists of an object with the following fields:
Field | Type | Description |
|
| Unique identifier of the requisition |
|
| Boolean indicating whether the captured face is identical to the face registered for the entered |
|
| Information of the document reported for authentication |
|
| Probability of eyes being open in captured selfie |
Close SDK
close(): Promise<void>
close(): Promise<void>
The method used to remove the SDK on the screen.
De-initialize the SDK
dispose(): Promise<void>
dispose(): Promise<void>
The method used to remove the SDK on the screen.
Will de-initialize the video stream and clear the SDK's internal variables
Complete Example
Soon.
Last updated