From 4411b182b08dcb64d4cbeeb3eb4ce590815eaf6b Mon Sep 17 00:00:00 2001 From: Adrien Lombard Date: Mon, 10 Mar 2025 18:20:38 +0100 Subject: [PATCH] fix(fingerprint-aio) : Added optional parameters to isAvailable() (#4912) * Update fingerprint-aio/index.ts Added two optional parameters to FingerprintAIO.isAvailable to reflect the optional parameters of isAvailable in cordova-plugin-fingerprint-aio * Update index.ts Added documentation to isAvailable() * Update index.ts Added documentation to plugin * Added "callbackOrder : 'reverse'" to isAvailable() --- .../plugins/fingerprint-aio/index.ts | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts b/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts index c7859810b..e879fa198 100644 --- a/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts +++ b/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts @@ -157,6 +157,22 @@ export interface FingerprintSecretOptions extends FingerprintOptions { invalidateOnEnrollment?: boolean; } +export interface FingerprintAvailableOptions { + /** + * (Android): If true will only return success if Class 3 (BIOMETRIC_STRONG) Biometrics are enrolled on the device. + * It is reccomended you use this if planning on using the registerBiometricSecret and loadBiometricSecret methods. + */ + requireStrongBiometrics: boolean; + + /** + * (iOS): If true checks if backup authentication option is available, e.g. passcode. + * Default: false, which means check for biometrics only. + * + * @default false + */ + allowBackup?: boolean; +} + /** * @name Fingerprint AIO * @description @@ -209,6 +225,7 @@ export interface FingerprintSecretOptions extends FingerprintOptions { * @interfaces * FingerprintOptions * FingerprintSecretOptions + * FingerprintAvailableOptions */ @Plugin({ pluginName: 'FingerprintAIO', @@ -223,11 +240,14 @@ export class FingerprintAIO extends AwesomeCordovaNativePlugin { /** * Check if fingerprint authentication is available * + * @param {FingerprintAvailableOptions} options Options for platform specific fingerprint API * @returns {Promise} Returns a promise with result which depends on device and os. * iPhone X will return 'face' other Android or iOS devices will return 'finger' Android P+ will return 'biometric' */ - @Cordova() - isAvailable(): Promise { + @Cordova({ + callbackOrder: 'reverse' + }) + isAvailable(options: FingerprintAvailableOptions): Promise { return; }