hidden-service
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

hidden-service

Usage

import { start } from "hidden-service"

const { hostname } = await start({
  port: 80, // Same as { 80: 80 } or { 80: "127.0.0.1:80" }
})

console.log(hostname) // n72...uqd.onion

API

const { hostname, tor, hiddenServiceDirectory } = await start(options)

options:

{
  port: 80, // Default port, maps to 127.0.0.1:80
  privateKey: undefined // Optional Ed25519 private key
}
  • tor spawned ChildProcess.
  • hostname onion hostname (n72...uqd.onion).
  • hiddenServiceDirectory directory containing (hs_ed25519_secret_key, hs_ed25519_public_key, hostname) (created using fs.mkdtemp).

Resolves once Tor is fully bootstrapped.

const privateKey = await getRandomPrivateKey()

privateKey, 32 byte Uint8Array with a random Ed25519 private key (re-exported from noble-ed25519).

const secretKey = await getSecretKey(privateKey)

secretKey, 96 byte Uint8Array expanded and tagged privateKey.

const publicKey = await getPublicKey(privateKey)

publicKey, 64 byte Uint8Array tagged publicKey.

const hostname = getHostname(publicKey)

hostname, version 3 onion address.

Package Sidebar

Install

npm i hidden-service

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

8.23 kB

Total Files

7

Last publish

Collaborators

  • rogerbf