|
1 | 1 | export enum ERROR_CODES {
|
2 |
| - PASSWORD_FALLBACK_SELECTED = -3, // historically this is what iOS uses, so using that as well |
3 |
| - DEVELOPER_ERROR = 10, |
4 |
| - NOT_AVAILABLE = 20, |
5 |
| - NOT_CONFIGURED = 30, |
6 |
| - NOT_RECOGNIZED = 40, |
7 |
| - RECOVERABLE_ERROR = 50, |
8 |
| - USER_CANCELLED = 60, |
9 |
| - UNEXPECTED_ERROR = 70 |
| 2 | + PASSWORD_FALLBACK_SELECTED = -3, // historically this is what iOS uses, so using that as well |
| 3 | + DEVELOPER_ERROR = 10, |
| 4 | + NOT_AVAILABLE = 20, |
| 5 | + NOT_CONFIGURED = 30, |
| 6 | + NOT_RECOGNIZED = 40, |
| 7 | + RECOVERABLE_ERROR = 50, |
| 8 | + USER_CANCELLED = 60, |
| 9 | + UNEXPECTED_ERROR = 70, |
10 | 10 | }
|
11 | 11 |
|
12 | 12 | export interface VerifyFingerprintOptions {
|
13 |
| - /** |
14 |
| - * The required title in the fingerprint page for android. |
15 |
| - * Default: whatever the device default is ('Confirm your password' is likely) |
16 |
| - */ |
17 |
| - title?: string; |
18 |
| - /** |
19 |
| - * The optional subtitle in the fingerprint page for android. |
20 |
| - * Default: Empty |
21 |
| - */ |
22 |
| - subTitle?: string; |
23 |
| - /** |
24 |
| - * The optional message in the fingerprint dialog on ios and page description on android. |
25 |
| - * Default: 'Scan your finger' on iOS and the device default on Android (which is likely 'Enter your device password to continue'). |
26 |
| - */ |
27 |
| - message?: string; |
28 |
| - /** |
29 |
| - * The optional negative button text in the fingerprint page for android. |
30 |
| - * Default: "Cancel" |
31 |
| - */ |
32 |
| - cancelText?: string; |
33 |
| - /** |
34 |
| - * The optional confirm button after biometrics have been verified in the fingerprint page for android. |
35 |
| - * Default: False |
36 |
| - */ |
37 |
| - confirm?: boolean; |
| 13 | + /** |
| 14 | + * The required title in the fingerprint page for android. |
| 15 | + * Default: whatever the device default is ('Confirm your password' is likely) |
| 16 | + */ |
| 17 | + title?: string; |
| 18 | + /** |
| 19 | + * The optional subtitle in the fingerprint page for android. |
| 20 | + * Default: Empty |
| 21 | + */ |
| 22 | + subTitle?: string; |
| 23 | + /** |
| 24 | + * The optional message in the fingerprint dialog on ios and page description on android. |
| 25 | + * Default: 'Scan your finger' on iOS and the device default on Android (which is likely 'Enter your device password to continue'). |
| 26 | + */ |
| 27 | + message?: string; |
| 28 | + /** |
| 29 | + * The optional negative button text in the fingerprint page for android. |
| 30 | + * Default: "Cancel" |
| 31 | + */ |
| 32 | + cancelText?: string; |
| 33 | + /** |
| 34 | + * The optional confirm button after biometrics have been verified in the fingerprint page for android. |
| 35 | + * Default: False |
| 36 | + */ |
| 37 | + confirm?: boolean; |
38 | 38 | }
|
39 | 39 |
|
40 |
| -export interface VerifyFingerprintWithCustomFallbackOptions extends VerifyFingerprintOptions{ |
41 |
| - /** |
42 |
| - * The optional button label when scanning the fingerprint fails. |
43 |
| - * Default: 'Enter password'. |
44 |
| - */ |
45 |
| - fallbackMessage?: string; |
| 40 | +export interface VerifyFingerprintWithCustomFallbackOptions extends VerifyFingerprintOptions { |
| 41 | + /** |
| 42 | + * The optional button label when scanning the fingerprint fails. |
| 43 | + * Default: 'Enter password'. |
| 44 | + */ |
| 45 | + fallbackMessage?: string; |
46 | 46 | }
|
47 | 47 |
|
48 | 48 | export interface BiometricIDAvailableResult {
|
49 |
| - any: boolean; |
50 |
| - touch?: boolean; |
51 |
| - face?: boolean; |
52 |
| - biometrics?: boolean; |
| 49 | + any: boolean; |
| 50 | + touch?: boolean; |
| 51 | + face?: boolean; |
| 52 | + biometrics?: boolean; |
53 | 53 | }
|
54 | 54 |
|
55 | 55 | //noinspection JSUnusedGlobalSymbols
|
56 | 56 | export interface FingerprintAuthApi {
|
57 |
| - available(): Promise<BiometricIDAvailableResult>; |
| 57 | + available(): Promise<BiometricIDAvailableResult>; |
58 | 58 |
|
59 |
| - didFingerprintDatabaseChange(): Promise<boolean>; |
60 |
| - /** |
61 |
| - * This (recommended) method uses keychain instead of localauth so the passcode fallback can be used. |
62 |
| - * On Android, when 'useCustomAndroidUI' is set to 'true', and the user opted for manually entering the password, |
63 |
| - * this method may return a string (the entered password) for you to compare to the actual password. |
64 |
| - */ |
65 |
| - verifyFingerprint(options: VerifyFingerprintOptions): Promise<void | string>; |
| 59 | + didFingerprintDatabaseChange(): Promise<boolean>; |
| 60 | + /** |
| 61 | + * This (recommended) method uses keychain instead of localauth so the passcode fallback can be used. |
| 62 | + * On Android, when 'useCustomAndroidUI' is set to 'true', and the user opted for manually entering the password, |
| 63 | + * this method may return a string (the entered password) for you to compare to the actual password. |
| 64 | + */ |
| 65 | + verifyFingerprint(options: VerifyFingerprintOptions): Promise<void | string>; |
66 | 66 |
|
67 |
| - /** |
68 |
| - * This implementation uses LocalAuthentication and has no built-in passcode fallback on iOS. |
69 |
| - * On Android this is exactly the same as 'verifyFingerprint' |
70 |
| - */ |
71 |
| - verifyFingerprintWithCustomFallback( |
72 |
| - options: VerifyFingerprintWithCustomFallbackOptions |
73 |
| - ): Promise<void>; |
| 67 | + /** |
| 68 | + * This implementation uses LocalAuthentication and has no built-in passcode fallback on iOS. |
| 69 | + * On Android this is exactly the same as 'verifyFingerprint' |
| 70 | + */ |
| 71 | + verifyFingerprintWithCustomFallback(options: VerifyFingerprintWithCustomFallbackOptions): Promise<void>; |
74 | 72 |
|
75 |
| - close(): void; |
| 73 | + close(): void; |
76 | 74 | }
|
0 commit comments