1 | ;
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var plugin_1 = require('./plugin');
|
9 | /**
|
10 | * @name TouchID
|
11 | * @description
|
12 | * Scan the fingerprint of a user with the TouchID sensor.
|
13 | *
|
14 | * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
|
15 | *
|
16 | * @usage
|
17 | * ### Import Touch ID Plugin into Project
|
18 | * ```typescript
|
19 | * import { TouchID } from 'ionic-native';
|
20 | * ```
|
21 | * ### Check for Touch ID Availability
|
22 | * ```typescript
|
23 | * TouchID.isAvailable()
|
24 | * .then(
|
25 | * res => console.log('TouchID is available!'),
|
26 | * err => console.error('TouchID is not available', err)
|
27 | * );
|
28 | * ```
|
29 | * ### Invoke Touch ID w/ Custom Message
|
30 | *
|
31 | * ```typescript
|
32 | * TouchID.verifyFingerprint('Scan your fingerprint please')
|
33 | * .then(
|
34 | * res => console.log('Ok', res),
|
35 | * err => console.error('Error', err)
|
36 | * );
|
37 | * ```
|
38 | *
|
39 | * ### Error Codes
|
40 | *
|
41 | * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
|
42 | *
|
43 | * Here is a list of some of the error codes:
|
44 | *
|
45 | * - `-1` - Fingerprint scan failed more than 3 times
|
46 | * - `-2` or `-128` - User tapped the 'Cancel' button
|
47 | * - `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button
|
48 | * - `-4` - The scan was cancelled by the system (Home button for example)
|
49 | * - `-6` - TouchID is not Available
|
50 | * - `-8` - TouchID is locked out from too many tries
|
51 | */
|
52 | var TouchID = (function () {
|
53 | function TouchID() {
|
54 | }
|
55 | /**
|
56 | * Checks Whether TouchID is available or not.
|
57 | *
|
58 | * @returns {Promise<any>} Returns a Promise that resolves if yes, rejects if no.
|
59 | */
|
60 | TouchID.isAvailable = function () { return; };
|
61 | /**
|
62 | * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
|
63 | *
|
64 | * @param {string} message The message to display
|
65 | * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
|
66 | */
|
67 | TouchID.verifyFingerprint = function (message) { return; };
|
68 | /**
|
69 | * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
|
70 | *
|
71 | * @param {string} message The message to display
|
72 | * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
|
73 | */
|
74 | TouchID.verifyFingerprintWithCustomPasswordFallback = function (message) { return; };
|
75 | /**
|
76 | * Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
|
77 | *
|
78 | * @param {string} message The message to display
|
79 | * @param {string} enterPasswordLabel Custom text for the 'Enter Password' button
|
80 | * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
|
81 | */
|
82 | TouchID.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel = function (message, enterPasswordLabel) { return; };
|
83 | __decorate([
|
84 | plugin_1.Cordova()
|
85 | ], TouchID, "isAvailable", null);
|
86 | __decorate([
|
87 | plugin_1.Cordova()
|
88 | ], TouchID, "verifyFingerprint", null);
|
89 | __decorate([
|
90 | plugin_1.Cordova()
|
91 | ], TouchID, "verifyFingerprintWithCustomPasswordFallback", null);
|
92 | __decorate([
|
93 | plugin_1.Cordova()
|
94 | ], TouchID, "verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel", null);
|
95 | TouchID = __decorate([
|
96 | plugin_1.Plugin({
|
97 | pluginName: 'TouchID',
|
98 | plugin: 'cordova-plugin-touch-id',
|
99 | pluginRef: 'plugins.touchid',
|
100 | repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id',
|
101 | platforms: ['iOS']
|
102 | })
|
103 | ], TouchID);
|
104 | return TouchID;
|
105 | }());
|
106 | exports.TouchID = TouchID;
|
107 | //# sourceMappingURL=touchid.js.map |
\ | No newline at end of file |