Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
cordova-plugin-biometric-auth
Advanced tools
Readme
Biometric authentication with optional KeyguardManager API for Cordova.
cordova plugin add cordova-plugin-biometric-auth
Checks if the user can authenticate with either biometrics, fallback PIN, pattern or password. Biometric requires at least one biometric sensor to be present, enrolled, and available on the device.
cordova.plugins.BiometricAuth.isAvailable(successCallback, errorCallback, [optionalParams])
optionalParams | |
---|---|
authenticators | int: An optional bit field representing the types of Authenticators that may be used for authentication on Android. Omit or use 0 to check for either biometrics or device credentials. Use 1 to check for KeyguardManager authentication. |
Not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, DEVICE_CREDENTIAL
alone is unsupported prior to API 30, and BIOMETRIC_STRONG | DEVICE_CREDENTIAL
is unsupported on API 28-29.
This filler platform always returns BIOMETRIC_SUCCESS and does not check nor use a real biometric device.
authenticators
value passed is 0
or 1
: The user can authenticate with KeyuardManager methods.Check for any biometric enrolled, PIN, pattern or password availability.
var onSuccess = function (strSuccess) {
console.log(strSuccess);
};
var onError = function (strError) {
console.warn(strError);
};
cordova.plugins.BiometricAuth.isAvailable(onSuccess, onError);
Check for any biometric (e.g. fingerprint, iris, or face) on the device that meets or exceeds the requirements for Class 2. Requires at least API 23 (Android 6).
var Authenticators = {
KEYGUARD_MANAGER: 1,
BIOMETRIC_STRONG: 15,
BIOMETRIC_WEAK: 255,
DEVICE_CREDENTIAL: 32768
};
var onSuccess = function (strSuccess) {
console.log(strSuccess);
};
var onError = function (strError) {
console.warn(strError);
};
var optionalParams = {
authenticators = Authenticators.BIOMETRIC_WEAK;
};
cordova.plugins.BiometricAuth.isAvailable(onSuccess, onError, optionalParams);
Shows the biometric prompt or the fallback device credential dialog for authentication.
cordova.plugins.BiometricAuth.authenticate(successCallback, errorCallback, [optionalParams])
optionalParams | |
---|---|
title | string: The title to be displayed on the prompt. Defaults to Enter unlock credentials. |
subtitle | string: The subtitle to be displayed on the prompt. |
disableBackup | boolean: Removes the backup option from the prompt. Defaults to false . |
Android-specific | |
authenticators | int: A bit field representing all valid authenticator types that may be invoked by the prompt. Use 0 to allow either biometrics or device credentials. Use 1 to invoke KeyguardManager PIN, pattern, password or biometric if enrolled authentication. |
negativeButtonText | string: Sets the text for the cancel button on the prompt. Required whenever fallback is disabled. |
Not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, DEVICE_CREDENTIAL
alone is unsupported prior to API 30, and BIOMETRIC_STRONG | DEVICE_CREDENTIAL
is unsupported on API 28-29.
Browser platforms shows a dialog to manually select either of these results and does not perform any actual biometric check:
Prompt the user for biometric, PIN, pattern or password credentials.
var onSuccess = function (strSuccess) {
console.log(strSuccess);
};
var onError = function (strError) {
console.warn(strError);
};
var optionalParams = {
title = "Confirm operation",
subtitle = "Verify with biometrics to continue",
};
cordova.plugins.BiometricAuth.authenticate(onSuccess, onError, optionalParams);
BIOMETRIC_STRONG
without checking its availability with isAvailable first.DEVICE_CREDENTIALS
alone prior to API 30.BIOMETRIC_STRONG + DEVICE_CREDENTIAL
on API 28-29.1
to the authenticators param.0
or 1
will discard the disableBackup option.DEVICE_CREDENTIAL
authenticator.
Please report any issue with this plugin in GitHub by providing detailed context and sample code. PRs to improve and add new features or platforms are always welcome.
FAQs
Biometric authentication with optional KeyguardManager API for Cordova.
The npm package cordova-plugin-biometric-auth receives a total of 3 weekly downloads. As such, cordova-plugin-biometric-auth popularity was classified as not popular.
We found that cordova-plugin-biometric-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.