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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-nitro-tor

v0.5.1

Published

Tor Daemon and Onion Routing Client for React-Native

Readme

react-native-nitro-tor

A Tor Daemon and Onion Routing Client for React Native using pure C++ Craby.

Features

  • Run a Tor daemon directly in your React Native application
  • Create and manage Tor hidden services
  • Make HTTP requests over the Tor network (GET, POST, PUT, DELETE)
  • Built with performance in mind using React Native's NitroModules
  • Cross-platform support for Android, iOS and macOS

Installation

# Using npm
npm install react-native-nitro-tor

# Using yarn
yarn add react-native-nitro-tor

Platform Support

| Platform | Support | | -------- | --------------------------- | | iOS | ✅ | | macOS | ✅ | | Android | ✅ (arm64-v8a, x86_64, x86, armeabi-v7a) |

Usage

Basic Example

import { RnTor } from 'react-native-nitro-tor';

// Start Tor with a hidden service
const startTor = async () => {
  const result = await RnTor.startTorIfNotRunning({
    data_dir: '/path/to/tor/data',
    socks_port: 9050,
    target_port: 8080,
    timeout_ms: 60000,
  });

  if (result.is_success) {
    console.log(`Tor started successfully!`);
    console.log(`Onion address: ${result.onion_address}`);
    console.log(`Control: ${result.control}`);
  } else {
    console.error(`Failed to start Tor: ${result.error_message}`);
  }
};

// Shut down the Tor service
const shutdown = async () => {
  const result = await RnTor.shutdownService();
  console.log(`Tor shutdown ${result ? 'successful' : 'failed'}`);
};

HTTP Methods Over Tor

import { RnTor } from 'react-native-nitro-tor';

// Make an HTTP GET request through Tor
const makeGetRequest = async () => {
  const result = await RnTor.httpGet({
    url: 'http://example.com',
    headers: '',
    timeout_ms: 2000,
  });
  console.log(`Status code: ${result.status_code}`);
  console.log(`Response body: ${result.body}`);
  if (result.error) {
    console.error(`Error: ${result.error}`);
  }
};

// Make an HTTP POST request through Tor
const makePostRequest = async () => {
  const result = await RnTor.httpPost({
    url: 'http://httpbin.org/post',
    body: '{"test":"data"}',
    headers: '{"Content-Type":"application/json"}',
    timeout_ms: 2000,
  });
  console.log(`Status code: ${result.status_code}`);
  console.log(`Response body: ${result.body}`);
  if (result.error) {
    console.error(`Error: ${result.error}`);
  }
};

// Make an HTTP PUT request through Tor
const makePutRequest = async () => {
  const result = await RnTor.httpPut({
    url: 'http://httpbin.org/put',
    body: '{"updated":"value"}',
    headers: '{"Content-Type":"application/json"}',
    timeout_ms: 2000,
  });
  console.log(`Status code: ${result.status_code}`);
  console.log(`Response body: ${result.body}`);
  if (result.error) {
    console.error(`Error: ${result.error}`);
  }
};

// Make an HTTP DELETE request through Tor
const makeDeleteRequest = async () => {
  const result = await RnTor.httpDelete({
    url: 'http://httpbin.org/delete',
    headers: '{"Content-Type":"application/json"}',
    timeout_ms: 2000,
  });
  console.log(`Status code: ${result.status_code}`);
  console.log(`Response body: ${result.body}`);
  if (result.error) {
    console.error(`Error: ${result.error}`);
  }
};

Advanced Usage

import { RnTor } from 'react-native-nitro-tor';

// Initialize Tor service
const initTor = async () => {
  const initialized = await RnTor.initTorService({
    socks_port: 9050,
    data_dir: '/path/to/tor/data',
    timeout_ms: 60000,
  });

  if (initialized) {
    console.log('Tor service initialized successfully');
    return true;
  }
  return false;
};

// Create a hidden service
const createService = async () => {
  const serviceResult = await RnTor.createHiddenService({
    port: 9055,
    target_port: 9056,
  });

  if (serviceResult.is_success) {
    console.log(`Created hidden service at: ${serviceResult.onion_address}`);
  }
};

// Get the current status of the Tor service.
// 0: Tor is in the process of starting.
// 1: Tor is running.
// 2: Stopped/Not running/error.

// Check service status
const checkStatus = async () => {
  const status = await RnTor.getServiceStatus();
  console.log(`Current Tor service status: ${status}`);
};

// Shutdown Tor service
const shutdown = async () => {
  const result = await RnTor.shutdownService();
  console.log(`Tor shutdown ${result ? 'successful' : 'failed'}`);
};

API Reference

Types

type ByteArray64 = number[];

interface TorConfig {
  socks_port: number;
  data_dir: string;
  timeout_ms: number;
}

interface HiddenServiceParams {
  port: number;
  target_port: number;
}

interface StartTorParams {
  data_dir: string;
  socks_port: number;
  target_port: number;
  timeout_ms: number;
}

interface StartTorResponse {
  is_success: boolean;
  onion_address: string;
  control: string;
  error_message: string;
}

interface HiddenServiceResponse {
  is_success: boolean;
  onion_address: string;
  control: string;
}

interface HttpGetParams {
  url: string;
  headers: string;
  timeout_ms: number;
}

interface HttpPostParams {
  url: string;
  body: string;
  headers: string;
  timeout_ms: number;
}

interface HttpPutParams {
  url: string;
  body: string;
  headers: string;
  timeout_ms: number;
}

interface HttpDeleteParams {
  url: string;
  headers: string;
  timeout_ms: number;
}

interface HttpResponse {
  status_code: number;
  body: string;
  error: string;
}

Methods

  • initTorService(config: TorConfig): Promise<boolean> Initialize the Tor service with the given configuration.

  • createHiddenService(params: HiddenServiceParams): Promise<HiddenServiceResponse> Create a new Tor hidden service with the specified parameters.

  • startTorIfNotRunning(params: StartTorParams): Promise<StartTorResponse> Start the Tor daemon with a hidden service if it's not already running. This is the recommended method for most use cases.

  • getServiceStatus(): Promise<number> Get the current status of the Tor service. 0: Tor is in the process of starting. 1: Tor is running. 2: Stopped/Not running/error.

  • deleteHiddenService(onionAddress: string): Promise<boolean> Delete an existing hidden service by its onion address.

  • shutdownService(): Promise<boolean> Completely shut down the Tor service.

  • httpGet(params: HttpGetParams): Promise<HttpResponse> Make an HTTP GET request through the Tor network.

  • httpPost(params: HttpPostParams): Promise<HttpResponse> Make an HTTP POST request through the Tor network.

  • httpPut(params: HttpPutParams): Promise<HttpResponse> Make an HTTP PUT request through the Tor network.

  • httpDelete(params: HttpDeleteParams): Promise<HttpResponse> Make an HTTP DELETE request through the Tor network.

Binary Files

  • iOS and MacOS: Binaries are located in the root of the project as Tor.xcframework
  • Android: Binaries are located in android/src/main/jniLibs

Architecture Support

  • Android: arm64-v8a, x86_64, x86

Running the example app

# Install dependencies
yarn install

# Generate native interfaces
yarn nitrogen

# Start metro
yarn example start

# For android
yarn example android

# For ios
yarn example ios

# IF ABOVE STEP FOR IOS THROWS ERRORS, you can also try:
cd example/ios && pod install

- Open the NitroTorExample.xcworkspace inside of xcode.
- Drag the Tor.xcframework from the root of the project to xcode project and select the "Copy files to destination" option.
- Build and run from inside of xcode.

License

MIT

Credits

This project builds upon the work of:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.