You are now ready to start the enrollment. Suppose you have an "Enroll" button and a corresponding trigger where you invoke the Keyless.enroll method or the deprecatedKeyless.shared.enrollCustomToken.
Depending on your application logic, you can choose to use different custom token. This could be a secret that you have provided to the app from the backend, the seed of an OTP protocol, or anything else. If you only need to know the result of the authentication (success/failed), you can pass any constant value as the custom token.
Optionally, start a loading indicator and show the progress by implementing two of the optional Keyless delegate methods:
funcenrollmentDidStart(){
DispatchQueue.main.async{[weakself]in
// Start loading indicator
}
}
funcenrollmentDidProgress(progress:Float){
DispatchQueue.main.async{[weakself]in
// Update the loading indicator to display `progress`
}
}
When enrollment finishes, the enrollmentDidFinish: keylessID: enrollmentResponse: error: method gets called. Note the keylessID of the user. In case of errors, prompt the user to try again.
If the process was successful, stop the loading indicator and navigate to the next screen of your application (e.g. success or main view).