Skip to content

satoshipay/cordova-plugin-fingerprint-aio

 
 

Repository files navigation

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

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

If you want to set a FaceID description use:

cordova plugin add https://github.com/satoshipay/cordova-plugin-fingerprint-aio.git
 --variable FACEID_USAGE_DESCRIPTION="Login now...."

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(message) {
      alert(message);
    }

Show authentication dialogue

Fingerprint.show({
      clientId: "Fingerprint-Demo", //Android: Used for encryption. iOS: used for dialogue if no `localizedReason` is given.
      clientSecret: "o7aoOMYUbyxaD23oFAnJ" //Necessary for Android encrpytion of keys. Use random secret key.
    }, successCallback, errorCallback);

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

    function errorCallback(err){
      alert("Authentication invalid " + err);
    }

Optional parameters

  • disableBackup: If true remove backup option on authentication dialogue for Android. Default: false.
  • localizedFallbackTitle (iOS only): Title of fallback button.
  • localizedReason (iOS only): Description in authentication dialogue.

Changes in this fork

During key generation the setUserAuthenticationRequired option is set to false to prevent errors due to android devices handling this option differently (see issue ticket).

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

License

About

👆 📱 Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 85.7%
  • Swift 7.3%
  • JavaScript 5.9%
  • Other 1.1%