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