Below, you can find an example on how to initiate the enrolment process for a passport enabling the reading through NFC and facial recognition:
var passport =newUqudoSDK.DocumentBuilder().setDocumentType(UqudoSDK.DocumentType.PASSPORT).enableReading(newUqudoSDK.ReadingConfigurationBuilder().forceReadingIfSupported(true).build() ).build();var enrollment =newUqudoSDK.EnrollmentBuilder().setToken(token).enableFacialRecognition().add(passport).setAppearanceMode(AppearanceMode.SYSTEM).build();try {constplugin=newUqudoSDK.UqudoPlugin();constresult=awaitplugin.enroll(enrollment);console.log(result.value);} catch (error) {console.log(JSON.parse(error.code));//example: {"code":"USER_CANCEL","message":"User canceled the Enrollment process","task":"SCAN"}}
In order to evaluate all the possible options please refer to paragraph Enrolment Flow. The TS interface is the porting of the JAVA one. In addition, you can check index.d.ts inside the plugin ./dist folder or directly from your IDE.
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:
Add the following code in your Javascript/Typescript to enable the tracing mechanism. Please refer to section Analytics for details.
window.addEventListener("TraceEvent", function (msg) { console.log("Trace Event: "+ JSON.stringify(msg)); });