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

onion-tools

v1.0.0

Published

A set of tools dedicated for onion domains manipulation.

Downloads

15

Readme

Tor onion domain tools

A set of tools dedicated to onion domains manipulation. Readme file is a pure overview, each exported method is documented better within its comments.

  • Requires Node >= 16.
  • Requires NPM >= 8.
  • Supports only onion V3 domains.

Get it via NPM:

npm i onion-tools

1. Domain generation

You can generate random domains, or deterministically from a predefined seed.

// Generate random domain.
const randomDomainObj = await generateV3OnionDomain()

// Generate domain from seed.
const domainFromSeedObj = await generateV3OnionDomain('some seed')

/**
 * outputs: {
 *  expandedPrivateKey: Buffer,
 *  publicKey: Buffer,
 *  domain: string,
 * }
 */
console.log(randomDomainObj)

By default the generated public/private keys pair cannot be imported by Tor onion service hosting. If you wish that sanitization pass another boolean parameter to the function. After that you will be able to write the keys to files and import them to onion hosting successfully.

// Generate random domain with keys pair sanitized for hosting import.
const { domain, expandedPrivateKey, publicKey } = await generateV3OnionDomain(undefined, true)

writeFileSync('./hs_ed25519_secret_key', expandedPrivateKey)
writeFileSync('./hs_ed25519_public_key', publicKey)
writeFileSync('./hostname', domain)

2. Domain validity

You can verify if a domain is valid or not based on it's syntax and checksum. Both methods return booleans.

const domain = 'ciadotgov4sjwlzihbbgxnqg3xiyrg7so2r2o3lt5wz5ypk4sxyjstad.onion'

// Verify domain syntax.
isValidV3OnionDomainSyntax(domain)

// Verify domain syntax + checksum.
isValidV3OnionDomain(domain)

3. Domain components

You can extract known components of a domain from it, such as public key, checksum and domain version.

const domain = 'ciadotgov4sjwlzihbbgxnqg3xiyrg7so2r2o3lt5wz5ypk4sxyjstad.onion'

const resultObj = extractV3Parts(domain)

/**
 * Outputs: {
 *  publicKey: Buffer,
 *  checksum: Buffer,
 *  version: Buffer,
 * }
 */
console.log(resultObj)

4. Testing / Contributing

You can test the features of this package by installing its dev dependencies and running the command:

npm run test

If you wish to contribute, PRs against main branch are welcomed but all previous tests must pass.