Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

#Passport Reader Cordova Plugin

The plugin allows your Android app to read data from a biometric passport.


  1. Clone the plugin source from Github:

    git clone --recurse-submodules
  2. Install the plugin in your Cordova project replacing path/to/plugin with the location of the plugin you cloned in the previous step:

    cordova plugin add path/to/plugin
  3. Build your project:

    cordova build android

Scanning Passports

// This object holds the information needed to start the scan
var bacSpec = {
	// Passport number
	"documentNumber": "123456789",
	// Date of birth of the passport holder in YYYY-MM-DD format
	"dateOfBirth": "1970-01-01",
	// Passport's date of expiry in YYYY-MM-DD format
	"dateOfExpiry": "2030-01-01",
// Start the scan
passportreader.scanPassport(bacSpec).then(function(result) {
	if (result == null) {
		// The user canceled the scan
	// See module documentation for result properties:
}).catch(function(error) {
	// The scan failed

Detecting a Face in the Result's Image

You can use the scan result's image for face detection using the Ver-ID plugin.

After installing the Ver-ID plugin following the instructions above Ver-ID will be available in window.verid.

See the Face type documentation for the properties of the returned face. You can pass the face's faceTemplate to Ver-ID's compareFaceTemplates function.

var passportFaceTemplate;

// Load Ver-ID
verid.load("myApiSecret").then(function() {
	// Scan the passport
	return passportreader.scanPassport(bacSpec);
}).then(function(result) {
	if (result == null) {
		// The user canceled the scan
	// Detect face in the passport image
	return verid.detectFaceInImage(result.image);
}).then(function(face) {
	if (!face) {
		// Canceled scan
	passportFaceTemplate = face.faceTemplate;
	var settings = new verid.LivenessDetectionSessionSettings();
	settings.includeFaceTemplatesInResult = true;
	return verid.captureLiveFace(settings);
}).then(function(result) {
	if (!result || result.outcome == verid.SessionOutcome.CANCEL) {
		// Canceled session
	if (result.outcome == verid.SessionOutcome.SUCCESS) {
		return verid.compareFaceTemplates(result.getFaces(verid.Bearing.STRAIGHT)[0].faceTemplate, passportFaceTemplate);
	} else {
		throw new Error(result.outcome);
}).then(function(score) {
	alert("Similarity score: "+score);
}).catch(function(error) {

API Reference

Module documentation

You can’t perform that action at this time.