Giter Site home page Giter Site logo

shepelt / cordova-plugin-android-fingerprint-auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mjwheatley/cordova-plugin-android-fingerprint-auth

0.0 2.0 0.0 371 KB

A cordova plugin for fingerprint authentication using the hardware fingerprint scanner on devices running Android 6+

License: Apache License 2.0

Java 98.10% JavaScript 1.90%

cordova-plugin-android-fingerprint-auth's Introduction

#About This plugin was created referencing the Fingerprint Dialog sample and the Confirm Credential sample referenced by the Android 6.0 APIs webpage.

This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.

#Screenshots ###Fingerprint Auth Dialog Fingerprint Auth Dialog | Fingerprint Auth Dialog Success | Fingerprint Auth Dialog Fail | Fingerprint Auth Dialog Too Many | Fingerprint Auth Dialog No Backup | Fingerprint Auth Dialog No Backup ###Backup Credentials Confirm Password | Confirm PIN | Confirm Pattern

#Installation meteor add cordova:cordova-plugin-android-fingerprint-auth

#Setup Add preference to mobile-config.js

App.setPreference('android-targetSdkVersion', '23');

set compile version and build tools in build.gradle

compileSdkVersion 23
buildToolsVersion "23.0.2"

#API ###FingerprintAuth.show(config, successCallback, errorCallbck)

Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.

Config Object

Param Type Default Description
clientId String undefined (REQUIRED) Used as the alias for your key in the Android Key Store.
clientSecret String undefined (REQUIRED) Used to encrypt the token returned upon successful fingerprint authentication.
disableBackup boolean false Set to true to remove the "USE BACKUP" button
locale String "en_US" Change the language. Available languages (English: "en_US", Spanish: "es"

Example

FingerprintAuth.show({
            clientId: "myAppName",
            clientSecret: "a_very_secret_encryption_key"
        }, successCallback, errorCallback);

/**
 * @return {withFingerprint:base64EncodedString, withPassword:boolean}
 */
function successCallback(result) {
    console.log("successCallback(): " + JSON.stringify(result));
    if (result.withFingerprint) {
        console.log("Successfully authenticated using a fingerprint");
    } else if (result.withPassword) {
        console.log("Authenticated with backup password");
    }
}

function errorCallback(error) {
    console.log(error); // "Fingerprint authentication not available"
}

###FingerprintAuth.isAvailable(successCallback, errorCallback)

Example

FingerprintAuth.isAvailable(isAvailableSuccess, isAvailableError);

/**
 * @return {
 *      isAvailable:boolean,
 *      isHardwareDetected:boolean,
 *      hasEnrolledFingerprints:boolean
 *   }
 */
function isAvailableSuccess(result) {
    console.log("FingerprintAuth available: " + JSON.stringify(result));
    if (result.isAvailable) {
        FingerprintAuth.show({
                    clientId: "myAppName",
                    clientSecret: "a_very_secret_encryption_key"
                }, successCallback, errorCallback);
    }
}

function isAvailableError(message) {
    console.log("isAvailableError(): " + message);
}

cordova-plugin-android-fingerprint-auth's People

Contributors

mjwheatley avatar pbakondy avatar shepelt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.