Skip to content

A Cordova plugin to determine whether the device has a secure lock mechanism configured, such as a PIN, pattern, password, fingerprint, or Face ID. Compatible with both iOS & Android.

Notifications You must be signed in to change notification settings

Binuka97/cordova-plugin-device-security-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-device-security-check

A Cordova plugin to determine whether the device has a secure lock mechanism configured, such as a PIN, pattern, password, fingerprint, or Face ID.


🔐 Features

  • 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.

📦 Installation

Install the plugin using the Cordova CLI:

cordova plugin add cordova-plugin-device-security-check

💻 Usage

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);
  }
);

📱 Platforms Supported

  • ✅ Android
  • ✅ iOS

📘 API

DeviceSecurityCheck.isDeviceSecure(successCallback, errorCallback)

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.

🛠️ How It Works

Android

Uses KeyguardManager.isKeyguardSecure() to detect whether a secure lock screen is set (PIN, pattern, password, fingerprint, etc.).

iOS

Uses LocalAuthentication framework with canEvaluatePolicy: to check if any authentication mechanism (passcode, Face ID, or Touch ID) is set.


📄 License

This project is licensed under the MIT License.


🙋‍♂️ Author

Developed by Binuka Kamesh

Feel free to submit issues or pull requests to improve the plugin.

About

A Cordova plugin to determine whether the device has a secure lock mechanism configured, such as a PIN, pattern, password, fingerprint, or Face ID. Compatible with both iOS & Android.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published