A Cordova plugin to check if the device has a secure lock screen setup (PIN, pattern, password, fingerprint, or Face ID).
npm install cordova-plugin-device-security-checkA Cordova plugin to determine whether the device has a secure lock mechanism configured, such as a PIN, pattern, password, fingerprint, or Face ID.
---
- Detect if the device has any secure lock screen mechanism.
- Supports PIN, password, pattern, fingerprint (Touch ID), and Face ID.
- Works on both Android and iOS.
---
Install the plugin using the Cordova CLI:
``bash`
cordova plugin add cordova-plugin-device-security-check
---
`javascript`
DeviceSecurityCheck.isDeviceSecure(
function(isSecure) {
if (isSecure) {
console.log("Device is secured with lock screen.");
} else {
console.log("No secure lock screen set on device.");
}
},
function(error) {
console.error("Error checking device security:", error);
}
);
---
- ✅ Android
- ✅ iOS
---
Checks whether the device has any secure lock mechanism enabled.
#### Parameters:
- successCallback: Function that receives a boolean (true if secure, false if not).errorCallback
- : Function that receives an error message if the check fails.
---
Uses KeyguardManager.isKeyguardSecure()) to detect whether a secure lock screen is set (PIN, pattern, password, fingerprint, etc.).
Uses LocalAuthentication framework with canEvaluatePolicy:` to check if any authentication mechanism (passcode, Face ID, or Touch ID) is set.
---
This project is licensed under the MIT License.
---
Developed by Binuka Kamesh
Feel free to submit issues or pull requests to improve the plugin.