cordova-plugin-onyx
C++ C Objective-C Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
res/ios/Resources added iOS platform Apr 27, 2016
src updated iOS to return WSQ image Feb 22, 2017
www added WSQ Image Type Feb 12, 2017
.gitignore initial commit Apr 25, 2016
LICENSE
README.md version 0.2.0 Feb 25, 2017
build-extras.gradle updated onyx-enroll-wizard Feb 25, 2017
changelog.md version 0.2.0 Feb 25, 2017
package.json
plugin.xml version 0.2.0 Feb 25, 2017

README.md

This is not free software. This plugin uses the Onyx sofware development kits (SDKs) for Android and iOS. It requires a license agreement with:

Diamond Fortress Technologies, Inc.

cordova-plugin-onyx

This plugin defines a global navigator.onyx object, which provides an API for capturing a fingerprint image, for in-app fingerprint enrollment and verification, and for fingerprint template generation for server side fingerprint authentication.

Although the object is attached to the global scoped navigator, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(navigator.onyx);
}

Installation

Contact Diamond Fortress Technologies, Inc. and sign a license agreement to obtain a license key.

This requires cordova 5.0+

    cordova plugin add cordova-plugin-onyx
    meteor add cordova:cordova-plugin-onyx

Quick Use Example

MeteorJS applications

Create a settings.json file to load at runtime.

{
    "public": {
        "onyxLicense": "xxxx-xxxx-xxxx-x-x"
    }
}

Reference the Onyx license when you execute an Onyx action.

var onyxOptions = {
    onyxLicense = Meteor.settings.public.onyxLicense;
    action = Onyx.Action.IMAGE;
}
navigator.onyx.exec(onyxOptions, onyxSuccessCallback, onyxErrorCallback);

Run the application on a mobile device

meteor run android-device --settings settings.json

API Reference


onyx

onyx.exec(options, successCallback, errorCallback)

Executes onyx with the specified options.

Supported Platforms

  • Android

Kind: static method of onyx

Param Type Description
options OnyxOptions Parameters telling onyx what to execute.
successCallback onSuccess
errorCallback onError

Example

navigator.onyx.exec(onyxOptions, onyxSuccess, onyxError);

onyx.onError : function

Callback function that provides an error message.

Kind: static typedef of onyx

Param Type Description
message string The message is provided by the device's native code.

onyx.onSuccess : function

Callback function that provides the image data.

Kind: static typedef of onyx

Param Type Description
result onyx Object containing the results of the executed action.

Example

// Show image
//
function onyxSuccess(result) {
    if (result.action === Onyx.Action.IMAGE) {
        var image = document.getElementById('myImage');
           image.src = result.imageUri;    
    }
}

onyx.OnyxOptions : Object

Optional parameters to customize onyx settings.

Kind: static typedef of onyx
Properties

Name Type Default Description
onyxLicense number xxxx-xxxx-xxxx-x-x Required Your license key for Onyx.
action Action undefined Required Choose the action for onyx to execute.
imageTypes Array<ImageType> [ImageType.PREPROCESSED] Array of image types to return as a base64 encoded data URI's.

onyx.OnyxResult : JSON Object

Results return by Onyx.

Kind: static typedef of onyx
Properties

Name Type Action Description
images JSON Object Onyx.Action.IMAGE JSON Object containing base64 encoded fingerprint JPEG images. "data:image/jpeg;base64," + base64EncodedString.

Defaults to imageType: Onyx.ImageType.PREPROCESSED

{
    "raw": "base64EncodedImageUri",
    "preprocessed": "base64EncodedImageUri",
    "enhanced": "base64EncodedImageUri",
    "wsq": {
        "bytes": "base64EncodedBytes",
        "nfiqScore": number
    }
}
template string Onyx.Action.TEMPLATE Onyx.Action.ENROLL Base64 encoded fingerprint template to send to backend server.
nfiqScore number Onyx.Action.VERIFY The result score of a verify action.
isVerified boolean Onyx.Action.VERIFY The fingerprint match result.

Onyx

Onyx.Action : JSON Object

Kind: static constants for actions of Onyx
Properties

Name Type Value Description
IMAGE string image Return a base64 encoded fingerprint image URI.
TEMPLATE string template Return a base64 encoded fingerprint template
ENROLL string enroll Enroll a fingerprint for your application to be stored on the local device and return the base64 encoded fingerprint template.
VERIFY string verify Performs on device verification against the enrolled fingerprint.

Onyx.ImageType : JSON Object

Kind: static constants for image types of Onyx
Properties

Name Type Value Description
RAW string raw Return the raw fingerprint image as a base64 encoded data URI.
PREPROCESSED string preprocessed Return the preprocessed fingerprint image as a base64 encoded data URI.
ENHANCED string enhanced Return the enhanced fingerprint image as a base64 encoded data URI.
WSQ JSON Object wsq Return a JSON Object containing the WSQ Image data.

{ wsq: { bytes: base64EncodedString, nfiqScore: number } }

Example

var onyxOptions = {
            onyxLicense: MY_ONYX_LICENSE,
            action: Onyx.Action.IMAGE, 
            imageTypes: [Onyx.ImageType.ENHANCED, Onyx.ImageType.WSQ]
        }
navigator.onyx.exec(onyxOptions, onyxSuccess, onyxError);

// TypeScript
private onyxSuccess(result) {
    var self = this;
    console.log("successCallback(): " + JSON.stringify(result));
    console.log("action: " + result.action);
    switch (result.action) {
        case Onyx.Action.IMAGE:
            if (result.hasOwnProperty("images")) {
                var images:any = result.images;
                var preprocessedImageUri:string;
                var rawImageUri:string;
                var enhancedImageUri:string;

                if (images.hasOwnProperty(Onyx.ImageType.RAW)) {
                    console.log("images contains raw image URI");
                    rawImageUri = images[Onyx.ImageType.RAW];
                }
                if (images.hasOwnProperty(Onyx.ImageType.PREPROCESSED)) {
                    console.log("images contains preprocessed image URI");
                    preprocessedImageUri = images[Onyx.ImageType.PREPROCESSED];
                }
                if (images.hasOwnProperty(Onyx.ImageType.ENHANCED)) {
                    console.log("images contains enhanced image URI");
                    enhancedImageUri = images[Onyx.ImageType.ENHANCED];
                }
                if (images.hasOwnProperty(Onyx.ImageType.WSQ)) {
                    console.log("images contains WSQ image");
                    var wsqImage:any = images[Onyx.ImageType.WSQ];
                    if (wsqImage) {
                        console.log("wsqImageNfiqScore: " + wsqImage.nfiqScore);
                        if (wsqImage.nfiqScore > 0 && wsqImage.nfiqScore < 5) {
                            // Do something with the WSQ image
                        } else {
                            // Show dialog indicating "Poor Image Quality"
                        }
                    }
                }
                Session.set("imageUri", imageUri);
            }
            break;
    }
}