📅  最后修改于: 2023-12-03 15:00:02.157000             🧑  作者: Mango
Cordova-plugin-fingerprint-aio is a fingerprint authentication plugin for Cordova/PhoneGap that supports Android and iOS devices. This plugin provides a simple and easy-to-use API for developers to enable fingerprint authentication in their apps.
To install the plugin in your Cordova project, run the following command:
cordova plugin add cordova-plugin-fingerprint-aio --save
To use this plugin in your app, you can call Fingerprint.show(options, successCallback, errorCallback)
method, which shows a fingerprint authentication dialog.
Fingerprint.show({
clientId: "myAppName",
clientSecret: "myAppSecret",
disableBackup:true,
localizedReason: "Authenticate securely by scanning your fingerprint"
}, function(success){
console.log("Auth succeeded");
}, function(error){
console.log(error);
});
The following options are available for Fingerprint.show()
method:
| Option | Type | Description |
| ------------------- | --------- | ------------------------------------------------------------------- |
| clientId
| String
| The client ID to use for authentication. |
| clientSecret
| String
| The client secret to use for authentication. |
| localizedReason
| String
| The localized message displayed in the fingerprint dialog. |
| disableBackup
| Boolean
| A flag indicating whether to disable the backup authentication. |
| cancelText
| String
| The text to display on the cancel button. Default value: Cancel
. |
| fallbackButtonTitle
| String
| The text to display on the fallback button. Default value: Use Pin
. |
| disableAndroidCancel
| Boolean
| A flag indicating whether to disable the Android native dialog with cancel button. |
| androidFingerPrintNotRecognizedTitle
| String
| The text to display on the fingerprint not recognized dialog title. Default value: Fingerprint not recognized
. |
| androidFingerPrintNotRecognizedMessage
| String
| The text to display on the fingerprint not recognized dialog message. Default value: Try again
. |
| androidNotAvailableTitle
| String
| The text to display on the fingerprint not available dialog title. Default value: Fingerprint not available
. |
| androidNotAvailableMessage
| String
| The text to display on the fingerprint not available dialog message. Default value: Try again
. |
The successCallback
function is called when the authentication is successful.
function(success){
console.log("Auth succeeded");
}
The errorCallback
function is called when the authentication fails.
function(error){
console.log(error);
}
disableBackup
is set to false
, the user will be given the option to enter their backup password.fallbackButtonTitle
button instead.NSFaceIDUsageDescription
key is set in the app's Info.plist
file.This plugin is released under the MIT License.