Getting started
To use PassiveFaceLiveness, you can either remotely import the .js file or download it locally.
npm i @combateafraude/identity-sdk
Include the .js file directly from the CDN:
<script src="https://repo.combateafraude.com/identity/<VERSION>/index.umd.js" type="text/javascript">
</script>
SDK | Category | Version |
---|---|---|
Identity | Stable |
The SDK's constructor method takes the Identity token as a parameter (see how to get yours here). In addition, you can optionally enter the SDK's initialization options.
import IdentitySdk from '@combateafraude/identity-sdk';
const identityToken = 'your token';
const identity = new IdentitySdk(identityToken);
<script src="https://repo.combateafraude.com/identity/0.0.9/index.js" type="text/javascript">
</script>
[...]
<script>
const identityToken = 'your token';
const identity = new this['@combateafraude/identity-sdk'].Sdk(identityToken);
</script>
Field | Type | Required? | Description |
mobileToken | boolean | No* | |
throwOnRecall | boolean | No | Indicates whether, when called a second time without the first call having completed, the SDK should throw an error. If not entered or entered false, the SDK returns the existing Promise without triggering an error. If true, the SDK rejects the Promise on the second call. |
theme | | No | |
smsLabel | | No | |
emailLabel | | No | |
pendingPageSettings | | No | |
authIcon | string | No | Icon used at the top of the authentication screens |
enableTimer | boolean | No | Enables or disables the timer in case of SMS and E-mail validation |
language | string | No | Defines the used language on SDK's texts default: pt-BR |
*You must inform mobileToken when you are using facial authentication in your policy
Field | Type | Required? | Description |
closeButton | string | No | Color used in the close button |
checkmark | string | No | Color used in the checkMark button |
loader | string | No | Color used in the loader button |
buttonSuccessColor | string | No | Color used in the success button |
inputSuccessColor | string | No | Color used in code input |
buttonFinishColor | string | No | Color used in code input |
timerBackgroundColor | string | No | Color used in the background of the timer if it is active |
timerColor | string | No | Color used in the timer text if it is active |
pendingIconSvg | string | No | Icon used in the pending context warning screen |
Field | Type | Required? | Description |
enable | string | No | Enables or disables the label |
link | string | No | Redirection link |
text | string | No | Text used in the label |
Field | Type | Required? | Description |
pendingIconSvg | string | No | Changes the icon showed when the PendingPage is open |
titleText | string | No | Title of the PendingPage |
descriptionText | string | No | Description of the PendingPage |
buttonContentText | string | No | Text used in the PendingPage confirm button |
Exemple:
const identityOptions = {
mobileToken: 'seu token mobile',
throwOnRecall: true,
theme: {
closeButton: '#000037',
pendingIconSvg:'./example.svg'
},
smsLabel: {
enable: true,
link: "https://www.google.com/",
text: "Its just a test SMS",
},
language: "string",
pendingPageSettings: {
pendingIconSvg?: "",
titleText?: "Não foi possível realizar a autenticação",
descriptionText?: "Para sua segurança, entre em contato com o suporte para prosseguir",
buttonContentText?: "Finalizar"
},
enableTimer: true,
authIcon: (new Image().src = "./exemple-sdk.png"),
};
const identityToken = 'seu token';
const identity = new IdentitySdk(identityToken, identityOptions);
Calling the SDK:
To verify a user, use the
verifyPolicy
method, available in the SDK instance.const cpf = 'User CPF';
const policyId = 'Policy ID'
const response = await identity.verifyPolicy(cpf, policyId);
if(identity.isSdkError(response)) {
// Error when running the SDK
}
else {
const { isAuthorized, attestation } = response;
if(isAuthorized) {
// User is authorized
// Send the attestation to your backend and validate it there
}
else {
// User is not authorized
}
}
Last modified 25d ago