All Projects โ†’ EddyVerbruggen โ†’ Cordova Plugin Touch Id

EddyVerbruggen / Cordova Plugin Touch Id

Licence: mit
๐Ÿ’… ๐Ÿ‘ฑโ€โ™‚๏ธ Forget passwords, use a fingerprint scanner!

Projects that are alternatives of or similar to Cordova Plugin Touch Id

Cordova Plugin Fingerprint Aio
๐Ÿ‘† ๐Ÿ“ฑ Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support
Stars: โœญ 236 (+12.92%)
Mutual labels:  fingerprint, touchid, cordova, cordova-plugin
Cordova Plugin Stripe
A Cordova plugin that lets you use Stripe's Native SDKs for Android and iOS.
Stars: โœญ 90 (-56.94%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Wechat
A cordova plugin, a JS version of Wechat SDK
Stars: โœญ 1,198 (+473.21%)
Mutual labels:  cordova, cordova-plugin
Unityionicintegration
A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
Stars: โœญ 94 (-55.02%)
Mutual labels:  cordova, cordova-plugin
Ionic4
This repo contains example code for ionic4. Get Step by Step tutorial of this repo examples using https://ampersandacademy.com/tutorials/ionic-framework-4
Stars: โœญ 37 (-82.3%)
Mutual labels:  cordova, cordova-plugin
Blinkid Cordova
ID scanning for cross-platform apps built with Cordova and Phonegap.
Stars: โœญ 44 (-78.95%)
Mutual labels:  cordova, cordova-plugin
Google Analytics Plugin
Cordova Google Analytics Plugin for Android & iOS
Stars: โœญ 90 (-56.94%)
Mutual labels:  cordova, cordova-plugin
Dyfauthidandgesturelock
ๆ‰‹ๅŠฟๅฏ†็ ่งฃ้”ๅ’Œ TouchID (ๆŒ‡็บน) / FaceID(้ขๅฎน) ่งฃ้”๏ผŒไปฃ็ ็ฎ€ๆด้ซ˜ๆ•ˆใ€‚(Gesture passcode unlocking and TouchID (fingerprint) / FaceID (facial features) unlocking, its code is concise and efficient.) https://github.com/dgynfi/DYFAuthIDAndGestureLock
Stars: โœญ 20 (-90.43%)
Mutual labels:  fingerprint, touchid
Wifiwizard2
A Cordova plugin for managing Wifi networks (new version of WiFiWizard) - Latest is version 3+
Stars: โœญ 106 (-49.28%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Add Swift Support
๐Ÿ”จ Swiftify your Cordova app !
Stars: โœญ 108 (-48.33%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Wkwebview File Xhr
Cordova Plugin for WebView File XHR
Stars: โœญ 116 (-44.5%)
Mutual labels:  cordova, cordova-plugin
Cl.kunder.webview
This cordova plugin enables you to open a second webview
Stars: โœญ 36 (-82.78%)
Mutual labels:  cordova, cordova-plugin
Awesome Cordova Plugins
A curated list of awesome Cordova Apache Plugins https://cordova.apache.org/plugins/
Stars: โœญ 33 (-84.21%)
Mutual labels:  cordova, cordova-plugin
Flutterauthfaceid Fingerprint
Stars: โœญ 64 (-69.38%)
Mutual labels:  fingerprint, touchid
Cordova Plugin Permissionscope
๐Ÿ”“ Cordova plugin to handle iOS permissions
Stars: โœญ 27 (-87.08%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Remote Injection
DEPRECATED: Cordova plugin to allow a remote site to interact with cordova's javascript APIs when loaded within a cordova app.
Stars: โœญ 90 (-56.94%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Audioinput
This iOS/Android Cordova/PhoneGap plugin enables audio capture from the device microphone, by in near real-time forwarding audio to the web layer of your application. A typical usage scenario for this plugin would be to use the captured audio as source for a web audio node chain, where it then can be analyzed, manipulated and/or played.
Stars: โœญ 137 (-34.45%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Disable Bitcode
Cordova plugin to disable bitcode in iOS build settings
Stars: โœญ 19 (-90.91%)
Mutual labels:  cordova, cordova-plugin
Quasar Cordova Fingerprint
๐Ÿ”’๐Ÿ‘๐Ÿ“ฑ Quasar + Cordova Fingerprint Plugin
Stars: โœญ 25 (-88.04%)
Mutual labels:  fingerprint, cordova
Cordova Broadcaster
Cordova Plugin to allow message exchange between javascript and native (and viceversa)
Stars: โœญ 104 (-50.24%)
Mutual labels:  cordova, cordova-plugin

Cordova TouchID Plugin

Also works with Face ID on iPhone X ๐Ÿš€

Index

  1. Description
  2. Screenshot
  3. Installation
  4. Usage
  5. Security++
  6. Face ID support

Description

Scan the fingerprint of your user with the TouchID sensor (iPhone 5S).

  • Compatible with Cordova Plugman.
  • Minimum iOS version is 8 (error callbacks will be gracefully invoked on lower versions).
  • Requires a fingerprint scanner, so an iPhone 5S or newer is required.

Screenshot

Distorted a bit because I created it back when Apple had not yet released the SDK and they're not a fan of developers posting screenshots of unreleased features.

ScreenShot

Installation

Automatically (CLI / Plugman)

Compatible with Cordova Plugman, compatible with PhoneGap 3.0 CLI, here's how it works with the CLI (backup your project first!):

From npm:

$ cordova plugin add cordova-plugin-touch-id
$ cordova prepare

The latest, from the master repo:

$ cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-touch-id
$ cordova prepare

TouchID.js is brought in automatically. There is no need to change or add anything in your html.

Manually

1. Add the following xml to your config.xml in the root directory of your www folder:

<feature name="TouchID">
  <param name="ios-package" value="TouchID" />
</feature>

You'll need to add the LocalAuthentication.framework and Security.framework to your project. Click your project, Build Phases, Link Binary With Libraries, search for and add the frameworks.

2. Grab a copy of TouchID.js, add it to your project and reference it in index.html:

<script type="text/javascript" src="js/TouchID.js"></script>

3. Download the source files and copy them to your project.

iOS: Copy the two .h and two .m files to platforms/ios/<ProjectName>/Plugins

Usage

First you'll want to check whether or not the user has a configured fingerprint scanner. You can use this to show a 'log in with your fingerprint' button next to a username/password login form.

window.plugins.touchid.isAvailable(
  function(type) {alert(type)}, // type returned to success callback: 'face' on iPhone X, 'touch' on other devices
  function(msg) {alert('not available, message: ' + msg)} // error handler: no TouchID available
);

If the onSuccess handler was called, you can scan the fingerprint. There are two options: verifyFingerprint and verifyFingerprintWithCustomPasswordFallback. The first method will offer a fallback option called 'enter passcode' which shows the default passcode UI when pressed. The second method will offer a fallback option called 'enter password' (not passcode) which allows you to provide your own password dialog.

window.plugins.touchid.verifyFingerprint(
  'Scan your fingerprint please', // this will be shown in the native scanner popup
   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted
   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason
);

The errorhandler of the method above can receive an error code of -2 which means the user pressed the 'enter password' fallback.

window.plugins.touchid.verifyFingerprintWithCustomPasswordFallback(
  'Scan your fingerprint please', // this will be shown in the native scanner popup
   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted
   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason
);

This will render a button labelled 'Enter password' in case the fingerprint is not recognized. If you want to provide your own label ('Enter PIN' perhaps), you can use awkwardly named function (added in version 3.1.0):

window.plugins.touchid.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(
  'Scan your fingerprint please', // this will be shown in the native scanner popup
  'Enter PIN', // this will become the 'Enter password' button label
   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted
   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason
);

You can copy-paste these lines of code for a quick test:

<button onclick="window.plugins.touchid.isAvailable(function(msg) {alert('ok: ' + msg)}, function(msg) {alert('not ok: ' + msg)})">Touch ID available?</button>
<button onclick="window.plugins.touchid.verifyFingerprint('Scan your fingerprint please', function(msg) {alert('ok: ' + msg)}, function(msg) {alert('not ok: ' + JSON.stringify(msg))})">Scan fingerprint</button>

"Biometry is locked out" (code: -8)

window.plugins.touchid.askPassword(
   'Enter password', // this will become the 'Enter password' label
   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint reactivated
   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error reason as string
);

Security++

Since iOS9 it's possible to check whether or not the list of enrolled fingerprints changed since the last time you checked it. It's recommended you add this check so you can counter hacker attacks to your app. See this article for more details.

So instead of checking the fingerprint after isAvailable add another check. In case didFingerprintDatabaseChange returns true you probably want to re-authenticate your user before accepting valid fingerprints again.

window.plugins.touchid.isAvailable(
    // success handler; available
    function() {
      window.plugins.touchid.didFingerprintDatabaseChange(
          function(changed) {
            if (changed) {
              // re-auth the user by asking for his credentials before allowing a fingerprint scan again
            } else {
              // call the fingerprint scanner
            }
          }
      );
    },
    // error handler; not available
    function(msg) {
      // use a more traditional auth mechanism
    }
);

Face ID Support

Since iOS 11, LocalAuthentication also supports Face ID for biometrics. This is a drop-in replacement for Touch ID and any existing apps using Touch ID will work identically on devices that use Face ID.

Since plugin version 3.3.0 the success callback of isAvailable receives the type of biometric ID, which is either touch or face.

You can use this to display "Face ID" or "Touch ID" as appropriate in your app.

window.plugins.touchid.isAvailable(
  function(type) {alert(type)}, // type returned to success callback: 'face' on iPhone X, 'touch' on other devices
  function(msg) {alert('not available, message: ' + msg)} // error handler: no TouchID available
);

If you want to alter the usage description in the consent popup, then override the default empty adds an empty NSFaceIDUsageDescription. To do so, pass the following variable when installing the plugin:

cordova plugin add cordova-plugin-touch-id --variable FACEID_USAGE_DESCRIPTION="For easy authentication"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].