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

react-native-safeguard

v0.1.0

Published

A comprehensive security library for React Native applications that helps protect against various security threats including root detection, malware, tampering, and more.

Downloads

61

Readme

react-native-safeguard

A comprehensive security library for React Native applications that helps protect against various security threats including root detection, malware, tampering, and more.

Features

  • Root/Jailbreak Detection
  • Developer Options Detection
  • Network Security Checks
  • Malware and Tampering Detection
  • Screen Mirroring Detection
  • App Spoofing Prevention
  • Key Logger Detection
  • Configurable Security Levels (SECURE, WARNING, ERROR)

Installation

npm install react-native-safeguard
# or
yarn add react-native-safeguard

Android Setup

  1. Add the following to your android/settings.gradle:
include ':react-native-safeguard'
project(':react-native-safeguard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-safeguard/android')
  1. Add the following to your android/app/build.gradle:
repositories {
    flatDir {
        dirs project(':react-native-safeguard').projectDir.toString() + '/libs'
    }
}

iOS Setup

Run pod install in your iOS directory:

cd ios && pod install

Usage

First, initialize the library with your desired security configuration:

import Safeguard from 'react-native-safeguard';

// Initialize with custom security levels
Safeguard.initialize({
  rootCheckState: 'ERROR',              // Fail if device is rooted/jailbroken
  developerOptionsCheckState: 'WARNING', // Warn if developer options are enabled
  malwareCheckState: 'WARNING',         // Warn if malware is detected
  tamperingCheckState: 'WARNING',       // Warn if app tampering is detected
  networkSecurityCheckState: 'WARNING', // Warn if network is not secure
  screenSharingCheckState: 'WARNING',   // Warn if screen mirroring is active
  appSpoofingCheckState: 'WARNING',     // Warn if app spoofing is detected
  keyloggerCheckState: 'WARNING',       // Warn if keylogger is detected
  expectedPackageName: 'com.your.app',  // Optional: Verify app package name
  expectedCertificateHash: 'your-hash'  // Optional: Verify app signature
}).catch(error => {
  console.error('Failed to initialize Safeguard:', error);
});

Then use the security check methods as needed:

// Check all security features
try {
  const result = await Safeguard.checkAll();
  console.log('Security check result:', result);
} catch (error) {
  console.error('Security check failed:', error);
}

// Or check specific features
try {
  const rootStatus = await Safeguard.checkRoot();
  const devOptions = await Safeguard.checkDeveloperOptions();
  const networkSecurity = await Safeguard.checkNetwork();
  const malware = await Safeguard.checkMalware();
  const screenMirroring = await Safeguard.checkScreenMirroring();
  const appSpoofing = await Safeguard.checkApplicationSpoofing();
  const keyLogger = await Safeguard.checkKeyLogger();
  
  console.log('Root Status:', rootStatus);
  // Handle other results...
} catch (error) {
  console.error('Security check failed:', error);
}

Security Check Results

Each security check returns a result object with the following structure:

interface SecurityCheckResult {
  status: 'SECURE' | 'WARNING' | 'ERROR';
  message: string;
}

Example

Check out the example directory for a complete demo application showing how to use all security features.

To run the example app:

# Clone the repository
git clone https://github.com/your-username/react-native-safeguard.git

# Install dependencies
cd react-native-safeguard
yarn install

# Run the example app
cd example
yarn install
# For iOS
cd ios && pod install && cd ..
yarn ios
# For Android
yarn android

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library