Need help with cordova-plugin-fingerprint-aio?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

NiklasMerz
238 Stars 150 Forks MIT License 459 Commits 29 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 24,267
C#
cpluspl...
ionic
biometr...
272 commits
# 222,673
C
cpluspl...
Shell
ionic
16 commits
# 356,889
ionic
Swift
Objecti...
biometr...
6 commits
# 316,994
HTML
Less
Angular
ionic
4 commits
# 393,590
ionic
Swift
Objecti...
biometr...
4 commits
# 413,717
Postgre...
ionic
biometr...
biometr...
3 commits
# 49,808
Django
univers...
skype
gmail
3 commits
# 461,132
ionic
Swift
Objecti...
biometr...
2 commits
# 749
GitHub
rust-la...
wechat-...
query-l...
2 commits
# 460,106
ionic
Swift
Objecti...
biometr...
2 commits
# 462,158
ionic
Swift
Objecti...
biometr...
2 commits
# 528,155
ionic
Swift
Objecti...
biometr...
1 commit
# 289,489
C
cpluspl...
ionic
biometr...
1 commit
# 527,146
ionic
Swift
Objecti...
biometr...
1 commit
# 524,219
ionic
Swift
Objecti...
biometr...
1 commit
# 389,715
biometr...
biometr...
TypeScr...
HTML
1 commit
# 515,247
ionic
Swift
Objecti...
biometr...
1 commit
# 523,309
ionic
Swift
Objecti...
biometr...
1 commit
# 526,139
ionic
Swift
Objecti...
biometr...
1 commit
# 525,144
ionic
Swift
Objecti...
biometr...
1 commit

Cordova Plugin Fingerprint All-In-One

For Android and iOS

GitHub license Issue Count

NPM

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

Features

Version 4.0

Version 4.0 of this plugin is a significant upgrade over the previous versions. Previous versions only allowed a visual fingerprint prompt. Version 4.0 allows saving an encrypted secret behind the biometric prompt for true security. Please test it out and report any issues. If this plugin has security issues please check the security policy. If you do audits using this plugin please let me know the results. My email is on my Github profile.

Version 4 was developed almost 100% by other people than me (@NiklasMerz). Please thank these awesome people for their work: @exxbrain, @leolio86400. This is a community driven plugin and I don't do any real development anymore. But triaging issues and rewiewing and testing PRs is cumbersome work. If you depend on this plugin for your product please consider becoming my sponsor on Github to keep it going for a while. Some day I may consider stop working on it and pass it on to somebody interested.

Version 4.0 is awesome so please us it and let us fix it:smile:.

Platforms

  • Android - Minimum SDK 23
  • iOS - latest XCode is required. Plugin sets Swift version 4.

How to use

Tutorial about using this plugin with Ionic thanks to Paul Halliday (old plugin version!!)


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 [email protected]

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, optionalParams);

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

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

Optional parameters

  • allowBackup (iOS): If
    true
    checks if backup authentication option is available, e.g. passcode. Default:
    false
    , which means check for biometrics only.

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:
    " 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.
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If
    false
    user confirmation is NOT required after a biometric has been authenticated . Default:
    true
    . See docs.

Register secret

Fingerprint.registerBiometricSecret({
      description: "Some biometric description",
      secret: "my-super-secret",
      invalidateOnEnrollment: true,
      disableBackup: true, // always disabled on Android
    }, successCallback, errorCallback);

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

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

This may show an authentication prompt.

Optional parameters

  • title: Title in authentication dialogue. Default:
    " 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. NOTE: it will be disabled on Android
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If
    false
    user confirmation is NOT required after a biometric has been authenticated . Default:
    true
    . See docs.
  • secret: String secret to encrypt and save, use simple strings matching the regex [a-zA-Z0-9-]+
  • invalidateOnEnrollment: If
    true
    secret will be deleted when biometry items are deleted or enrolled

Show authentication dialogue and load secret

Fingerprint.loadBiometricSecret({
      description: "Some biometric description",
      disableBackup: true, // always disabled on Android
    }, successCallback, errorCallback);

function successCallback(secret){
  alert("Authentication successful, secret: " + secret);
}

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

Optional parameters

  • title: Title in authentication dialogue. Default:
    " 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. NOTE: it will be disabled on Android
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If
    false
    user confirmation is NOT required after a biometric has been authenticated . Default:
    true
    . See docs.

Constants

  • BIOMETRICUNKNOWNERROR =
    -100
    ;
  • BIOMETRIC_UNAVAILABLE =
    -101
    ;
  • BIOMETRICAUTHENTICATIONFAILED =
    -102
    ;
  • BIOMETRICSDKNOT_SUPPORTED =
    -103
    ;
  • BIOMETRICHARDWARENOT_SUPPORTED =
    -104
    ;
  • BIOMETRICPERMISSIONNOT_GRANTED =
    -105
    ;
  • BIOMETRICNOTENROLLED =
    -106
    ;
  • BIOMETRICINTERNALPLUGIN_ERROR =
    -107
    ;
  • BIOMETRIC_DISMISSED =
    -108
    ;
  • BIOMETRICPINORPATTERNDISMISSED =
    -109
    ;
  • BIOMETRICSCREENGUARD_UNSECURED =
    -110
    ;
  • BIOMETRICLOCKEDOUT =
    -111
    ;
  • BIOMETRICLOCKEDOUT_PERMANENT =
    -112
    ;
  • BIOMETRICSECRETNOT_FOUND =
    -113
    ; ***

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.

License

The project is MIT licensed: MIT.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.