DEV Community

Reece Harris
Reece Harris

Posted on

Create tor v3 onion address from nodejs

In today's age, privacy and security are increasingly becoming essential concerns for online activities. One way to enhance your online anonymity and security is by using Tor, an open-source network that helps you to browse the web anonymously by bouncing your traffic through a series of relays. The Tor network is commonly associated with onion addresses, which are difficult to trace back to their source. One type of onion address is the Tor v3 address, which is now easier to generate using the TorV3 npm package.

The TorV3 npm package is a simple and straightforward way to generate Tor v3 addresses, along with their corresponding public and private keys. With TorV3, users can easily generate unique Tor v3 addresses that are difficult to trace back to their source, providing an additional layer of privacy to their online activities.

Github repo : https://github.com/NotReeceHarris/torv3
NPM pacakge : https://www.npmjs.com/package/torv3

(Vanity support in 1.1.0)

Installation

The installation of TorV3 is quite simple. To get started, ensure that you have Node.js version 12.x or higher and a node package manager like NPM installed on your system. Then, open your terminal or command prompt and enter the following command:

npm i -g torv3@latest
Enter fullscreen mode Exit fullscreen mode

This command will install TorV3 globally on your system, making it available to use from any directory. After installation, you can confirm that TorV3 is working correctly by running the following command in your terminal:

torv3 --version
Enter fullscreen mode Exit fullscreen mode

This should display the version number of TorV3 that you just installed.

Usage

TorV3 is easy to use and can be accomplished in two ways: through the command-line interface (CLI) or as a module.

Using TorV3 as a module

To use TorV3 as a module, import it into your JavaScript file using the following code:

const torv3 = require('torv3');
Enter fullscreen mode Exit fullscreen mode

Once imported, you can generate a pair of ed25519 keys using the generateKeys function:

const keys = torv3.generateKeys();
Enter fullscreen mode Exit fullscreen mode

This will return an object containing both the public and private keys.

You can also generate a Tor v3 address using the generateOnionV3 function:

const v3 = torv3.generateOnionV3();
Enter fullscreen mode Exit fullscreen mode

This will return an object containing the public and private keys, the Tor v3 address, and a boolean flag indicating whether the address is verified.

Using TorV3 as a CLI

If you prefer using the command line interface (CLI), TorV3 also provides a simple command-line interface that you can use to generate ed25519 keys and Tor v3 addresses.

To generate ed25519 keys, run the following command:

torv3 keys
Enter fullscreen mode Exit fullscreen mode

To generate a Tor v3 address, run the following command:

torv3 generate
Enter fullscreen mode Exit fullscreen mode

API

If you want more information on the API, TorV3 provides the following functions:

torv3.generateKeys

This function generates a pair of ed25519 keys. It takes an optional buffer of the ed25519 private key.

torv3.generateKeys(sk)
Enter fullscreen mode Exit fullscreen mode

torv3.generateOnionV3

This function generates a ed25519 key pair and a v3 hostname. It also takes an optional buffer of the ed25519 private key.

torv3.generateOnionV3(sk)
Enter fullscreen mode Exit fullscreen mode

In conclusion, TorV3 is an essential npm package for users who want to enhance their privacy and security on the Tor network. It is simple to install, easy to use, and provides both a CLI and a module interface for generating ed25519 keys and

Latest comments (0)