Git Product home page Git Product logo

dahang / cordova-plugin-fingerprint-aio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from greaterking/cordova-plugin-fingerprint-aio

0.0 1.0 0.0 672 KB

:point_up_2: :iphone: Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support

Home Page: https://www.npmjs.com/package/cordova-plugin-fingerprint-aio

License: MIT License

HCL 1.70% Java 55.43% Objective-C 0.62% Swift 26.92% JavaScript 15.33%

cordova-plugin-fingerprint-aio's Introduction

Cordova Plugin Fingerprint All-In-One

For Android and iOS

Gitter chat GitHub license Build Status Issue Count

NPM

This plugin provides a single and simple interface for accessing fingerprint APIs on both Android 6+ and iOS.

Features

  • Check if a fingerprint scanner is available
  • Fingerprint authentication
  • Ionic Native support
  • ngCordova support
  • Fallback options
  • Now with FaceID on iPhone X
  • ⚡️ Works with Capacitor. Try it out ⚡️

Platforms

  • Android - Minimum SDK 23
  • iOS - XCode 9.2 or higher required
    • Please set <preference name="UseSwiftLanguageVersion" value="4.0" /> in your config.xml

How to use

Tutorial about using this plugin with Ionic thanks to Paul Halliday

Examples

ngCordova Example

Ionic Native Example


Install

Install from NPM

cordova plugin add cordova-plugin-fingerprint-aio --save

If you want to set a FaceID description use:

cordova plugin add cordova-plugin-fingerprint-aio --variable FACEID_USAGE_DESCRIPTION="Login now...."

Use the release candidate for testing the latest fixes

You can use preview versions with the rc tag on npm.

cordova plugin add cordova-plugin-fingerprint-aio@rc

Use this Github repo

Get the latest development version. Not recommended!

cordova plugin add https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git

Check if fingerprint authentication is available

Fingerprint.isAvailable(isAvailableSuccess, isAvailableError);

    function isAvailableSuccess(result) {
      /*
      result depends on device and os. 
      iPhone X will return 'face' other Android or iOS devices will return 'finger'  
      */
      alert("Fingerprint available");
    }

    function isAvailableError(error) {
      // 'error' will be an object with an error code and message
      alert(error.message);
    }

Show authentication dialogue

Fingerprint.show({
      description: "Some biometric description"
    }, successCallback, errorCallback);

    function successCallback(){
      alert("Authentication successful");
    }

    function errorCallback(error){
      alert("Authentication invalid " + error.message);
    }

Optional parameters

  • title: Title in authentication dialogue. Default: "<APP_NAME> Biometric Sign On"
  • subtitle: Subtitle in authentication dialogue. Default: null
  • description: Description in authentication dialogue. Defaults:
  • fallbackButtonTitle: Title of fallback button. Defaults:
    • When disableBackup is true
      • "Cancel"
    • When disableBackup is false
      • iOS: "Use PIN"
      • Android: "Use Backup" (Because backup could be anything pin/pattern/password ..haven't figured out a reliable way to determine lock type yet source)
  • disableBackup: If true remove backup option on authentication dialogue. Default: false. This is useful if you want to implement your own fallback.

Constants

  • BIOMETRIC_UNKNOWN_ERROR = -100;
  • BIOMETRIC_UNAVAILABLE = -101;
  • BIOMETRIC_AUTHENTICATION_FAILED = -102;
  • BIOMETRIC_SDK_NOT_SUPPORTED = -103;
  • BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104;
  • BIOMETRIC_PERMISSION_NOT_GRANTED = -105;
  • BIOMETRIC_FINGERPRINT_NOT_ENROLLED = -106;
  • BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107;
  • BIOMETRIC_FINGERPRINT_DISMISSED = -108;
  • BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109;
  • BIOMETRIC_SCREEN_GUARD_UNSECURED = -110;
  • BIOMETRIC_LOCKED_OUT = -111;
  • BIOMETRIC_LOCKED_OUT_PERMANENT = -112;

Thanks to the authors of the original fingerprint plugins

Some code is refactored from their projects and I learned how to make Cordova plugins from their great plugins:

@EddyVerbruggen and @mjwheatley

Android

iOS

Starting with version 3.0.0 the iOS and Android parts are written from scratch.

Special thanks also to @anitaa1990 for the biometric lib that aar the file in this plugin is based on and to @pabloerag's fork that removed the androidx requirements.

Biometric-Auth-Sample

Forked version used to create aar

License

The project is MIT licensed: MIT.

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.