UNPKG

3.18 kBTypeScriptView Raw
1/**
2 * @name TouchID
3 * @description
4 * Scan the fingerprint of a user with the TouchID sensor.
5 *
6 * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
7 *
8 * @usage
9 * ### Import Touch ID Plugin into Project
10 * ```typescript
11 * import { TouchID } from 'ionic-native';
12 * ```
13 * ### Check for Touch ID Availability
14 * ```typescript
15 * TouchID.isAvailable()
16 * .then(
17 * res => console.log('TouchID is available!'),
18 * err => console.error('TouchID is not available', err)
19 * );
20 * ```
21 * ### Invoke Touch ID w/ Custom Message
22 *
23 * ```typescript
24 * TouchID.verifyFingerprint('Scan your fingerprint please')
25 * .then(
26 * res => console.log('Ok', res),
27 * err => console.error('Error', err)
28 * );
29 * ```
30 *
31 * ### Error Codes
32 *
33 * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
34 *
35 * Here is a list of some of the error codes:
36 *
37 * - `-1` - Fingerprint scan failed more than 3 times
38 * - `-2` or `-128` - User tapped the 'Cancel' button
39 * - `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button
40 * - `-4` - The scan was cancelled by the system (Home button for example)
41 * - `-6` - TouchID is not Available
42 * - `-8` - TouchID is locked out from too many tries
43 */
44export declare class TouchID {
45 /**
46 * Checks Whether TouchID is available or not.
47 *
48 * @returns {Promise<any>} Returns a Promise that resolves if yes, rejects if no.
49 */
50 static isAvailable(): Promise<any>;
51 /**
52 * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
53 *
54 * @param {string} message The message to display
55 * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
56 */
57 static verifyFingerprint(message: string): Promise<any>;
58 /**
59 * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
60 *
61 * @param {string} message The message to display
62 * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
63 */
64 static verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any>;
65 /**
66 * 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).
67 *
68 * @param {string} message The message to display
69 * @param {string} enterPasswordLabel Custom text for the 'Enter Password' button
70 * @returns {Promise<any>} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
71 */
72 static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any>;
73}