
The index.html file containing JavaScript that makes use of the
FingerprintAuthenticator API functionality is listed below.
The following examples show how you can use various methods of the FingerprintAuthenticator.
Creating a new instance of the FingerprintAuthenticator object:
var authenticator = window.launchbox.Authentication.authenticator(window.launchbox.Authentication.Type.FINGERPRINT_AUTHENTICATOR);
Checking if the device has been equipped with hardware that enables fingerprint authentication and if the user has already enrolled any fingerprints:
authenticator.checkAvailability()
.then(function(isAvailable){
console.log("Is Fingerprint Authentication available? " + isAvailable);
});Saving the credentials in the device's fingerprint-secured keychain:
authenticatior.create({identifier: "user", password: "rules"
.then(function(){
console.log("Created");
})
.catch(function(err){
console.log(JSON.stringify(err));
});Retrieving the credentials from the device's fingerprint-secured keychain:
authenticator.authenticate()
.then(function(payload){
console.log("Authenticated with " + JSON.stringify(payload));
})
.catch(function(err){
console.log(JSON.stringify(err));
});Deleting the credentials from the device's fingerprint-secured keychain:
authenticator.remove()
.then(function(){
console.log("Data removed");
})
.catch(function(err){
console.log(JSON.stringify(err));
});