npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-safeguard

v0.1.4

Published

Cordova plugin for security checks and device integrity verification

Downloads

343

Readme

Cordova Plugin Safeguard

A Cordova plugin for comprehensive security checks and device integrity verification on Android devices.

Features

  • Root Detection
  • Developer Options Detection
  • Malware and Tampering Detection
  • Network Security Checks
  • Screen Mirroring Detection
  • Application Spoofing Detection
  • Keylogger Detection

Installation

cordova plugin add cordova-plugin-safeguard

Or install directly from GitHub:

cordova plugin add https://github.com/webileapps/cordova-plugin-safeguard.git

Configuration

Add preferences to your config.xml to customize security check behaviors:

<preference name="ROOT_CHECK_STATE" value="ERROR" />
<preference name="DEVELOPER_OPTIONS_CHECK_STATE" value="WARNING" />
<preference name="MALWARE_CHECK_STATE" value="WARNING" />
<preference name="TAMPERING_CHECK_STATE" value="WARNING" />
<preference name="NETWORK_SECURITY_CHECK_STATE" value="WARNING" />
<preference name="SCREEN_SHARING_CHECK_STATE" value="WARNING" />
<preference name="APP_SPOOFING_CHECK_STATE" value="WARNING" />
<preference name="KEYLOGGER_CHECK_STATE" value="WARNING" />
<preference name="EXPECTED_PACKAGE_NAME" value="com.your.package.name" />

Each security check can be configured with one of these states:

  • ERROR: Blocks app usage when the check fails
  • WARNING: Shows a warning but allows continuing
  • DISABLED: Skip the check entirely

Usage

JavaScript API

// Run all security checks
Safeguard.checkAll(
    function(success) {
        console.log('All security checks passed');
    },
    function(error) {
        console.error('Security check failed:', error);
    }
);

// Individual checks
Safeguard.checkRoot(successCallback, errorCallback);
Safeguard.checkDeveloperOptions(successCallback, errorCallback);
Safeguard.checkMalware(successCallback, errorCallback);
Safeguard.checkNetwork(successCallback, errorCallback);
Safeguard.checkScreenMirroring(successCallback, errorCallback);
Safeguard.checkApplicationSpoofing(successCallback, errorCallback);
Safeguard.checkKeyLogger(successCallback, errorCallback);

Automatic Checks

The plugin automatically performs security checks at these times:

  1. When the app starts
  2. When the activity starts
  3. When the app resumes from background

Error Handling

The error callback receives a JSON object with:

{
    "title": "Security Check Name",
    "message": "Detailed message about the security issue",
    "type": "error" // or "warning"
}

Sample App

A sample application demonstrating all features is available in the sample directory. To run it:

cd sample
npm install
cordova platform add android
cordova run android

Requirements

  • Cordova >= 9.0.0
  • Android >= 9.0.0 (API Level 28)
  • Gradle >= 7.0.0

License

MIT License - see LICENSE file for details

Support

For bugs, questions, and discussions please use the GitHub Issues.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Development

To set up the development environment:

  1. Clone the repository
git clone https://github.com/webileapps/cordova-plugin-safeguard.git
cd cordova-plugin-safeguard
  1. Install dependencies
cd plugin
npm install
  1. Make your changes and test using the sample app
cd ../sample
npm install
cordova platform add android
cordova run android

Publishing

To publish a new version:

  1. Update version
cd plugin
npm version patch  # or minor/major
  1. Publish to npm
npm publish

This will automatically:

  • Update versions in package.json and plugin.xml
  • Create git tags
  • Publish to npm registry