{"_id":"@didux-io/cordova-plugin-touch-id","_rev":"1-485d6cc30646d4fa83dba22542cbfdee","name":"@didux-io/cordova-plugin-touch-id","dist-tags":{"latest":"3.4.0"},"versions":{"3.4.0":{"name":"@didux-io/cordova-plugin-touch-id","version":"3.4.0","description":"Scan the fingerprint of your user with the TouchID sensor, or the user's Face with Face ID on iPhone X","cordova":{"id":"@didux-io/cordova-plugin-touch-id","platforms":["ios"]},"repository":{"type":"git","url":"git+https://github.com/EddyVerbruggen/cordova-plugin-touch-id.git"},"keywords":["TouchID","Touch ID","Face ID","iPhone X","Fingerprint","Biometric","Scanner","ecosystem:cordova","cordova-ios"],"engines":[{"name":"cordova","version":">=3.0.0"}],"author":{"name":"Eddy Verbruggen","email":"eddyverbruggen@gmail.com","url":"https://github.com/EddyVerbruggen"},"license":"MIT","bugs":{"url":"https://github.com/EddyVerbruggen/cordova-plugin-touch-id/issues"},"homepage":"https://github.com/EddyVerbruggen/cordova-plugin-touch-id#readme","gitHead":"85bf49095f360d1aeef7828abd855eb3d5d00887","_id":"@didux-io/cordova-plugin-touch-id@3.4.0","_npmVersion":"6.1.0","_nodeVersion":"10.6.0","_npmUser":{"name":"danielsmilo","email":"daniel@smilo.io"},"dist":{"integrity":"sha512-Dt8ZzTG8KEvVKJqIIYTZEN8s1rZiLoB34bfC91OtoqSecqvq6kUq2A8+i0bm/4UoOhfC5fq2tNvKJGAJfpGV8w==","shasum":"99062d6287fb0212dc2ac1546787279a9e61e023","tarball":"https://registry.npmjs.org/@didux-io/cordova-plugin-touch-id/-/cordova-plugin-touch-id-3.4.0.tgz","fileCount":7,"unpackedSize":20991,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdZ9YBCRA9TVsSAnZWagAAD7wP/jvk+2vh571wf7KCGOgQ\navWFz6Kx/T2si1RYYXsc3z1gdK6XLmRxg1Px1D3sChlW3kYoIJV7KJ67qlh3\nMW5OsxVm8fCJ9HUX1oB32ZfdnES+O2XrR+JTCclpEMeJmGRhFK0EvM0gEYKN\nQiMfIgIdtLxtEfObv8LKNHcx2uRoxmI5TFQLuGzWPmD9jWorPnDggzkXQJde\nblXdxEnidmjD83z3vgo7DzH03//1/nt4AelSfMoDcKeh3LNXTSl2DLeWGnd9\nJ8OEeOn7MiHz0dWvbnIR8ms9gNrmimdxBKkZMNffn/kTzOiFbmWN7OrxOyYi\nDgq946uMnJF3I+EHlCfnf6MJU+MMr2ePaUtVzS3NKDVcDEuNoxa6ie01mXFv\nXxoC3EOcM3ideQy6qqmk5iiM7jfPPF7XEeU57EE9KMvXuP2b5D2b8cQcqhg4\nFZ8LnqOCRZBx8uNjBXa2JK6bGVCz9vYq6SF6ziQ8im1SjEJHPNKbv72YsrhX\nxsuranFfdJob4OpWIeJPuxohIgr4SfgIhnD8DInqIEGYOF4RNLshB4K09HC2\naWiF/ioxaFSfknGazVx61LD+h+dirKC1NjJ/m7jGYk9yFZ6l6+Rt6/HJsHLg\nfEUTeytevSWmemwZpQ58D0eT+F94TZmQaRtX3B9SaPNz8LlG1xEZRkh2WTNK\nOr3P\r\n=jY39\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDg7dYXe9uECcdnZJ6ySw5jxhGJoLQZywdrTEd2+N7tKAiEA3f90J6r2xq7MqRSTatrqfLYKWVm3Z0Oz6azRjJA2Lnk="}]},"maintainers":[{"name":"elkan","email":"info@smilo.io"},{"name":"danielsmilo","email":"daniel@smilo.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cordova-plugin-touch-id_3.4.0_1567086080599_0.7277200366723455"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-29T13:41:20.363Z","3.4.0":"2019-08-29T13:41:20.708Z","modified":"2022-04-05T04:23:49.038Z"},"maintainers":[{"name":"elkan","email":"info@smilo.io"},{"name":"danielsmilo","email":"daniel@smilo.io"}],"description":"Scan the fingerprint of your user with the TouchID sensor, or the user's Face with Face ID on iPhone X","homepage":"https://github.com/EddyVerbruggen/cordova-plugin-touch-id#readme","keywords":["TouchID","Touch ID","Face ID","iPhone X","Fingerprint","Biometric","Scanner","ecosystem:cordova","cordova-ios"],"repository":{"type":"git","url":"git+https://github.com/EddyVerbruggen/cordova-plugin-touch-id.git"},"author":{"name":"Eddy Verbruggen","email":"eddyverbruggen@gmail.com","url":"https://github.com/EddyVerbruggen"},"bugs":{"url":"https://github.com/EddyVerbruggen/cordova-plugin-touch-id/issues"},"license":"MIT","readme":"# Cordova TouchID Plugin\n\n> Also works with Face ID on iPhone X 🚀\n\n## Index\n\n1. [Description](#description)\n2. [Screenshot](#screenshot)\n3. [Installation](#installation)\n4. [Usage](#usage)\n5. [Security++](#security)\n6. [Face ID support](#face-id-support)\n\n## Description\n\nScan the fingerprint of your user with the TouchID sensor (iPhone 5S).\n\n* Compatible with [Cordova Plugman](https://github.com/apache/cordova-plugman).\n* Minimum iOS version is 8 (error callbacks will be gracefully invoked on lower versions).\n* Requires a fingerprint scanner, so an iPhone 5S or newer is required.\n\n## Screenshot\nDistorted 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.\n\n![ScreenShot](screenshots/TouchID-demo.PNG)\n\n## Installation\n\n### Automatically (CLI / Plugman)\nCompatible with [Cordova Plugman](https://github.com/apache/cordova-plugman), compatible with [PhoneGap 3.0 CLI](http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface_add_features), here's how it works with the CLI (backup your project first!):\n\nFrom npm:\n```\n$ cordova plugin add cordova-plugin-touch-id\n$ cordova prepare\n```\n\nThe latest, from the master repo:\n```\n$ cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-touch-id\n$ cordova prepare\n```\n\nTouchID.js is brought in automatically. There is no need to change or add anything in your html.\n\n### Manually\n\n1\\. Add the following xml to your `config.xml` in the root directory of your `www` folder:\n```xml\n<feature name=\"TouchID\">\n  <param name=\"ios-package\" value=\"TouchID\" />\n</feature>\n```\n\nYou'll need to add the `LocalAuthentication.framework` and `Security.framework` to your project.\nClick your project, Build Phases, Link Binary With Libraries, search for and add the frameworks.\n\n2\\. Grab a copy of TouchID.js, add it to your project and reference it in `index.html`:\n```html\n<script type=\"text/javascript\" src=\"js/TouchID.js\"></script>\n```\n\n3\\. Download the source files and copy them to your project.\n\niOS: Copy the two `.h` and two `.m` files to `platforms/ios/<ProjectName>/Plugins`\n\n## Usage\nFirst you'll want to check whether or not the user has a configured fingerprint scanner.\nYou can use this to show a 'log in with your fingerprint' button next to a username/password login form.\n```js\nwindow.plugins.touchid.isAvailable(\n  function(type) {alert(type)}, // type returned to success callback: 'face' on iPhone X, 'touch' on other devices\n  function(msg) {alert('not available, message: ' + msg)} // error handler: no TouchID available\n);\n```\n\nIf the onSuccess handler was called, you can scan the fingerprint.\nThere are two options: `verifyFingerprint` and `verifyFingerprintWithCustomPasswordFallback`.\nThe first method will offer a fallback option called 'enter passcode' which shows the default passcode UI when pressed.\nThe second method will offer a fallback option called 'enter password' (not passcode) which allows you to provide your own password dialog.\n```js\nwindow.plugins.touchid.verifyFingerprint(\n  'Scan your fingerprint please', // this will be shown in the native scanner popup\n   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted\n   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason\n);\n```\nThe errorhandler of the method above can receive an error code of `-2` which means the user pressed the 'enter password' fallback.\n\n```js\nwindow.plugins.touchid.verifyFingerprintWithCustomPasswordFallback(\n  'Scan your fingerprint please', // this will be shown in the native scanner popup\n   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted\n   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason\n);\n```\n\nThis will render a button labelled 'Enter password' in case the fingerprint is not recognized.\nIf you want to provide your own label ('Enter PIN' perhaps), you can use awkwardly named function (added in version 3.1.0):\n\n```js\nwindow.plugins.touchid.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(\n  'Scan your fingerprint please', // this will be shown in the native scanner popup\n  'Enter PIN', // this will become the 'Enter password' button label\n   function(msg) {alert('ok: ' + msg)}, // success handler: fingerprint accepted\n   function(msg) {alert('not ok: ' + JSON.stringify(msg))} // error handler with errorcode and localised reason\n);\n```\n\nYou can copy-paste these lines of code for a quick test:\n```html\n<button onclick=\"window.plugins.touchid.isAvailable(function(msg) {alert('ok: ' + msg)}, function(msg) {alert('not ok: ' + msg)})\">Touch ID available?</button>\n<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>\n```\n\n## Security++\nSince iOS9 it's possible to check whether or not the list of enrolled fingerprints changed since\nthe last time you checked it. It's recommended you add this check so you can counter hacker attacks\nto your app. See [this article](https://godpraksis.no/2016/03/fingerprint-trojan/) for more details.\n\nSo instead of checking the fingerprint after `isAvailable` add another check.\nIn case `didFingerprintDatabaseChange` returns `true` you probably want to re-authenticate your user\nbefore accepting valid fingerprints again.\n\n```js\nwindow.plugins.touchid.isAvailable(\n    // success handler; available\n    function() {\n      window.plugins.touchid.didFingerprintDatabaseChange(\n          function(changed) {\n            if (changed) {\n              // re-auth the user by asking for his credentials before allowing a fingerprint scan again\n            } else {\n              // call the fingerprint scanner\n            }\n          }\n      );\n    },\n    // error handler; not available\n    function(msg) {\n      // use a more traditional auth mechanism\n    }\n);\n```\n\n## Face ID Support\nSince iOS 11, LocalAuthentication also supports Face ID for biometrics. This is\na drop-in replacement for Touch ID and any existing apps using Touch ID will\nwork identically on devices that use Face ID.\n\nSince plugin version 3.3.0 the success callback of `isAvailable` receives\nthe type of biometric ID, which is either `touch` or `face`.\n\nYou can use this to display \"Face ID\" or \"Touch ID\" as appropriate in your app.\n\n```js\nwindow.plugins.touchid.isAvailable(\n  function(type) {alert(type)}, // type returned to success callback: 'face' on iPhone X, 'touch' on other devices\n  function(msg) {alert('not available, message: ' + msg)} // error handler: no TouchID available\n);\n```\n\nIf you want to alter the usage description in the consent popup, then override the\ndefault empty adds an empty `NSFaceIDUsageDescription`. To do so, pass the following variable when installing the plugin:\n\n```\ncordova plugin add cordova-plugin-touch-id --variable FACEID_USAGE_DESCRIPTION=\"For easy authentication\"\n```\n","readmeFilename":"README.md"}