Skip to content

Commit 99e6a53

Browse files
authored
feat(fingerprint-air): add new functions (#3530)
* Add the new "registerBiometricSecret" and "loadBiometricSecret" methods for 'fingerprint-aio' plugin * Update the response type for `loadBiometricSecret` * Add new error msg for Secret not Found
1 parent 14ec32b commit 99e6a53

File tree

1 file changed

+59
-0
lines changed
  • src/@ionic-native/plugins/fingerprint-aio

1 file changed

+59
-0
lines changed

src/@ionic-native/plugins/fingerprint-aio/index.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export interface FingerprintOptions {
3939
disableBackup?: boolean;
4040
}
4141

42+
export interface FingerprintSecretOptions extends FingerprintOptions {
43+
/**
44+
* String secret to encrypt and save, use simple strings matching the regex [a-zA-Z0-9\-]+
45+
*/
46+
secret: string;
47+
48+
/**
49+
* If `true` secret will be deleted when biometry items are deleted or enrolled
50+
* @default false
51+
*/
52+
invalidateOnEnrollment?: boolean;
53+
}
54+
4255
/**
4356
* @name Fingerprint AIO
4457
* @description
@@ -68,9 +81,30 @@ export interface FingerprintOptions {
6881
* .then((result: any) => console.log(result))
6982
* .catch((error: any) => console.log(error));
7083
*
84+
* ...
85+
*
86+
* this.faio.registerBiometricSecret({
87+
* description: "Some biometric description", // optional | Default: null
88+
* secret: "my-super-secret", // mandatory
89+
* invalidateOnEnrollment: true, // optional | Default: false
90+
* disableBackup: true, // (Android Only) | optional | always `true` on Android
91+
* })
92+
* .then((result: any) => console.log(result))
93+
* .catch((error: any) => console.log(error));
94+
*
95+
* ...
96+
*
97+
* this.faio.loadBiometricSecret({
98+
* description: "Some biometric description", // optional | Default: null
99+
* disableBackup: true, // always disabled on Android
100+
* })
101+
* .then((result: string) => console.log(result))
102+
* .catch((error: any) => console.log(error));
103+
*
71104
* ```
72105
* @interfaces
73106
* FingerprintOptions
107+
* FingerprintSecretOptions
74108
*/
75109
@Plugin({
76110
pluginName: 'FingerprintAIO',
@@ -146,6 +180,11 @@ export class FingerprintAIO extends IonicNativePlugin {
146180
* @type {number}
147181
*/
148182
BIOMETRIC_LOCKED_OUT_PERMANENT = -112;
183+
/**
184+
* Convenience constant
185+
* @type {number}
186+
*/
187+
BIOMETRIC_SECRET_NOT_FOUND = -113;
149188

150189
/**
151190
* Check if fingerprint authentication is available
@@ -156,6 +195,26 @@ export class FingerprintAIO extends IonicNativePlugin {
156195
return;
157196
}
158197

198+
/**
199+
* Show authentication dialogue and register secret
200+
* @param {FingerprintSecretOptions} options Options for platform specific fingerprint API
201+
* @return {Promise<any>} Returns a promise that resolves when authentication was successful
202+
*/
203+
@Cordova()
204+
registerBiometricSecret(options: FingerprintSecretOptions): Promise<any> {
205+
return;
206+
}
207+
208+
/**
209+
* Show authentication dialogue and load secret
210+
* @param {FingerprintOptions} options Options for platform specific fingerprint API
211+
* @return {Promise<any>} Returns a promise that resolves when authentication was successful
212+
*/
213+
@Cordova()
214+
loadBiometricSecret(options: FingerprintOptions): Promise<string> {
215+
return;
216+
}
217+
159218
/**
160219
* Show authentication dialogue
161220
* @param {FingerprintOptions} options Options for platform specific fingerprint API

0 commit comments

Comments
 (0)