-
Notifications
You must be signed in to change notification settings - Fork 131
/
index.d.ts
216 lines (177 loc) · 6.23 KB
/
index.d.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
export const enum IFingerprintAuthErrors {
BAD_PADDING_EXCEPTION = "BAD_PADDING_EXCEPTION",
CERTIFICATE_EXCEPTION = "CERTIFICATE_EXCEPTION",
FINGERPRINT_CANCELLED = "FINGERPRINT_CANCELLED",
FINGERPRINT_DATA_NOT_DELETED = "FINGERPRINT_DATA_NOT_DELETED",
FINGERPRINT_ERROR = "FINGERPRINT_ERROR",
FINGERPRINT_NOT_AVAILABLE = "FINGERPRINT_NOT_AVAILABLE",
FINGERPRINT_PERMISSION_DENIED = "FINGERPRINT_PERMISSION_DENIED",
FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST = "FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST",
ILLEGAL_BLOCK_SIZE_EXCEPTION = "ILLEGAL_BLOCK_SIZE_EXCEPTION",
INIT_CIPHER_FAILED = "INIT_CIPHER_FAILED",
INVALID_ALGORITHM_PARAMETER_EXCEPTION = "INVALID_ALGORITHM_PARAMETER_EXCEPTION",
IO_EXCEPTION = "IO_EXCEPTION",
JSON_EXCEPTION = "JSON_EXCEPTION",
MINIMUM_SDK = "MINIMUM_SDK",
MISSING_ACTION_PARAMETERS = "MISSING_ACTION_PARAMETERS",
MISSING_PARAMETERS = "MISSING_PARAMETERS",
NO_SUCH_ALGORITHM_EXCEPTION = "NO_SUCH_ALGORITHM_EXCEPTION"
}
/**
* The Cordova "FingerprintAuth" plugin
* See {@link https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth}
*/
interface IFingerprintAuth {
/**
* @description Opens a native dialog fragment to use the device hardware fingerprint scanner
* to authenticate against fingerprints registered for the device.
*
* @param {FingerprintAuthIsAvailableSuccess} successCallback - Success callback.
* @param {string} errorCallback - Error callback.
*/
isAvailable(successCallback, errorCallback): void;
/**
* @description Call encrypt() show the Authentication Dialog.
*
* @param {FingerprintAuthConfig} encryptConfig - Encrypt config.
* @param {FingerprintAuthEncryptSuccess} encryptSuccessCallback - Encrypt success callback.
* @param {IFingerprintAuthErrors} encryptErrorCallback - Encrypt error callback.
*/
encrypt(encryptConfig, encryptSuccessCallback, encryptErrorCallback): void;
/**
* @description Call decrypt() show the Authentication Dialog.
*
* @param {FingerprintAuthConfig} decryptConfig - decryptConfig.
* @param {FingerprintAuthDecryptSuccess} encryptSuccessCallback - Encrypt success callback.
* @param {IFingerprintAuthErrors} encryptErrorCallback - Encrypt error callback.
*/
decrypt(decryptConfig, encryptSuccessCallback, encryptErrorCallback): void;
/**
* @description Call delete() when you want to delete the cipher for the user.
*
* @param {FingerprintDeleteConfig} config
* @param {Object} successCallback - Success callback.
* @param {string} errorCallback - Error callback.
*/
delete(config, successCallback, errorCallback): void;
}
interface FingerprintAuthIsAvailableSuccess {
/**
* @description Fingerprint Authentication Dialog is available for use.
*/
isAvailable: boolean;
/**
* @description Device has hardware fingerprint sensor.
*/
isHardwareDetected: boolean;
/**
* @description Device has any fingerprints enrolled.
*/
hasEnrolledFingerprints: boolean;
}
interface FingerprintAuthEncryptSuccess {
/**
* @description User authenticated using a fingerprint.
*/
withFingerprint: boolean;
/**
* @description User authenticated using backup credentials.
*/
withBackup: boolean;
/**
* @description Will contain the base64 encoded credentials upon successful fingerprint authentication.
*/
token: string;
}
interface FingerprintAuthDecryptSuccess {
/**
* @description User authenticated using a fingerprint.
*/
withFingerprint: boolean;
/**
* @description User authenticated using backup credentials.
*/
withBackup: boolean;
/**
* @description Will contain the decrypted password upon successful fingerprint authentication.
*/
password: string;
}
interface FingerprintAuthConfig {
/**
* @description (REQUIRED) Used as the alias for your app's secret key in the Android Key Store.
* Also used as part of the Shared Preferences key for the cipher userd to encrypt the user credentials.
*/
clientId: string;
/**
* @description Used to create credential string for encrypted token and as alias to retrieve the cipher.
*/
username: string;
/**
* @description Used to create credential string for encrypted token.
*/
password: string;
/**
* @description Data to be decrypted. Required for decrypt().
*/
token: string;
/**
* @description Set to true to remove the "USE BACKUP" button.
*/
disableBackup: boolean;
/**
* @description The device max is 5 attempts. Set this parameter if you want to allow fewer than 5 attempts.
*/
maxAttempts: number;
/**
* @description Change the language displayed on the authentication dialog.
* English: "en_US"
* Italian: "it"
* Spanish: "es"
* Russian: "ru"
* French: "fr"
* Chinese (Simplified):
* "zh_CN"
* "zh_SG"
* Chinese (Traditional):
* "zh"
* "zh_HK"
* "zh_TW"
* "zh_MO"
* Norwegian: "no"
* Portuguese: "pt"
* Japanese: "ja"
* German: "de"
* Thai: "th"
* Arabic: "ar"
*/
locale: string;
/**
* @description Require the user to authenticate with a fingerprint to authorize every use of the key.
* New fingerprint enrollment will invalidate key and require backup authenticate to re-enable the fingerprint authentication dialog.
*/
userAuthRequired: boolean;
/**
* @description Set the title of the fingerprint authentication dialog.
*/
dialogTitle: string;
/**
* @description Set the message of the fingerprint authentication dialog.
*/
dialogMessage: string;
/**
* @description Set the hint displayed by the fingerprint icon on the fingerprint authentication dialog.
*/
dialogHint: string;
}
interface FingerprintDeleteConfig {
/**
* @description Identify which cipher to delete.
*/
username: string;
/**
* @description (REQUIRED) Used as the alias for your key in the Android Key Store.
*/
clientId: string;
}
declare var FingerprintAuth: IFingerprintAuth;