Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fingerprint-aio) : Added optional parameters to isAvailable() #4912

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -209,6 +225,7 @@ export interface FingerprintSecretOptions extends FingerprintOptions {
* @interfaces
* FingerprintOptions
* FingerprintSecretOptions
* FingerprintAvailableOptions
*/
@Plugin({
pluginName: 'FingerprintAIO',
Expand All @@ -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<BIOMETRIC_TYPE>} 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<BIOMETRIC_TYPE> {
@Cordova({
callbackOrder: 'reverse'
})
isAvailable(options: FingerprintAvailableOptions): Promise<BIOMETRIC_TYPE> {
return;
}

Expand Down