Below you can find an example on how to initiate the enrollment process for a passport enabling the reading through NFC and facial recognition:
var token ="<please put your token here>";try {var passport =newDocumentBuilder().setDocumentType(DocumentType.PASSPORT).enableReading(newReadingConfigurationBuilder().forceReadingIfSupported(true).build() ).build();var enrollmentConfiguration =newEnrollmentBuilder().setToken(token).enableFacialRecognition().add(passport).setAppearanceMode(AppearanceMode.SYSTEM).build();constsdk=newUqudoIdSDK();constresult=awaitsdk.enroll(enrollmentConfiguration);console.log(result);} catch (error) {console.log(JSON.parse(error.code));// {"code":"USER_CANCEL","message":"User canceled the Enrollment process","task":"SCAN"}}
In order to evaluate all the possible options please refer to section Enrolment Flow. The JS interface is the porting of the Kotlin implementation. You can find the JS implementation in uqudoBuilder/uqudo.js under the uqudoid module path.
If successful, the response is a JSON Web Signature (JWS). Please refer to section "SDK result" for further details.
In case of a failure, the callback returns the following object:
Property
Type
Optional
Default
Description
code
String
No
None
message
String
Yes
null
Description of the error if any
task
String
Yes
null
Add the following event to enable the tracing mechanism. Please refer to section Analytics for details.