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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-safety-utils

v0.2.0

Published

A React Native utility library for detecting device security risks

Readme

📦 react-native-safety-utils

react-native-safety-utils is a lightweight utility library for React Native that provides device and network safety checks like developer mode status, VPN usage, proxy detection, screen mirroring status, mocked location detection, and more.


🚀 Features

  • Check if Developer Options are enabled
  • Detect Screen Mirroring
  • Check if VPN is active
  • Detect Proxy usage
  • Check if Location Services are enabled
  • Detect Mocked/Fake Location (with permission)

📲 Installation

npm install react-native-safety-utils

or

yarn add react-native-safety-utils

for iOS

cd ios && pod install

⚙️ Permissions Required

Some of the utilities require location permissions on both Android and iOS. Make sure you request and handle the following permissions if you use isVpnActive and isMockedLocation

Android

Add this to your AndroidManfiest:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

// Add only if you use isVpnActive

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

iOS

Add this to your Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is used to detect location spoofing</string>

📘 API Methods

Use a permission library like react-native-permissions to handle runtime permissions.

| Method | Description | | ----------------------------- | ---------------------------------------- | | isDeveloperOptionsEnabled() | Check if Developer Options are enabled | | isScreenMirroring() | Check if screen is being mirrored | | isVpnActive() | Check if a VPN is active | | isProxyEnabled() | Check if a proxy is configured | | isLocationEnabled() | Check if location services are turned on | | isMockedLocation() | Detect if the location is mocked/fake |

Example Usage

import { useState } from "react";
import { View, StyleSheet, Button, Text, ScrollView, Platform } from "react-native";
import SafetyUtils from "react-native-safety-utils";
import { request, PERMISSIONS, RESULTS } from "react-native-permissions";

export default function App() {

    const [isDevOptionsEnabled, setIsDevOptionsEnabled] = useState<string>();
    const [isScreenMirroring, setIsScreenMirroring] = useState<string>();
    const [isVpnActive, setIsVPNActive] = useState<string>();
    const [isProxyEnabled, setIsProxyEnabled] = useState<string>();
    const [isLocationEnabled, setIsLocationEnabled] = useState<string>();
    const [isMockedLocation, setIsMockedLocation] = useState<string>();

    const checkDevOptions = async () => {
        const isEnabled = await SafetyUtils.isDeveloperOptionsEnabled();
        setIsDevOptionsEnabled(String(isEnabled));
    };

    const checkScreenMirroring = async () => {
        const isEnabled = await SafetyUtils.isScreenMirroring();
        setIsScreenMirroring(String(isEnabled));
    };

    const checkVpn = async () => {
        const isEnabled = await SafetyUtils.isVpnActive();
        setIsVPNActive(String(isEnabled));
    };

    const checkProxy = async () => {
        const isEnabled = await SafetyUtils.isProxyEnabled();
        setIsProxyEnabled(String(isEnabled));
    };

    const checkPermission = async () => {
        const permission = Platform.OS === "ios" ? PERMISSIONS.IOS.LOCATION_WHEN_IN_USE : PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION;
        return request(permission);
    };

    const checkLocationEnabled = async () => {
        const isEnabled = await SafetyUtils.isLocationEnabled();
        setIsLocationEnabled(String(isEnabled));
    };

    const checkMockLocation = async () => {
        const status = await checkPermission();
        if (status === RESULTS.GRANTED) {
            const isEnabled = await SafetyUtils.isMockedLocation();
            setIsMockedLocation(String(isEnabled));
        } else {
            console.log("Location Permission Required");
        };
    };

    return (
        <ScrollView style={styles.container}>
            <View style={styles.rowContainer}>
                <Text>Developer Options Enabled ? : {isDevOptionsEnabled}</Text>
                <Button title="Check" onPress={checkDevOptions} />
            </View>
            <View style={styles.rowContainer}>
                <Text>Is Screen Mirroring ? : {isScreenMirroring}</Text>
                <Button title="Check" onPress={checkScreenMirroring} />
            </View>
            {/* Android - ACCESS_NETWORK_STATE permission needed to add in Android Manifest */}
            <View style={styles.rowContainer}>
                <Text>Is VPN Active ? : {isVpnActive}</Text>
                <Button title="Check" onPress={checkVpn} />
            </View>
            <View style={styles.rowContainer}>
                <Text>Is Proxy Enabled ? : {isProxyEnabled}</Text>
                <Button title="Check" onPress={checkProxy} />
            </View>
            <View style={styles.rowContainer}>
                <Text>Location Service Enabled ? : {isLocationEnabled}</Text>
                <Button title="Check" onPress={checkLocationEnabled} />
            </View>
            {/* Location Permission Required */}
            <View style={styles.rowContainer}>
                <Text>Is Mocked Location ? : {isMockedLocation}</Text>
                <Button title="Check" onPress={checkMockLocation} />
            </View>
        </ScrollView>
    );

};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        marginTop: 40,
        paddingBottom: 40,
        paddingHorizontal: "3%"
    },
    rowContainer: {
        flexDirection: "row",
        alignItems: "center",
        justifyContent: "space-between",
        paddingVertical: 20,
        borderRadius: 15,
        borderWidth: 1,
        borderColor: "black",
        paddingHorizontal: 10,
        marginVertical: 10
    }
});

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