1.4.0 • Published 4 years ago
hidden-service v1.4.0
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.onionAPI
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
}torspawnedChildProcess.hostnameonion hostname (n72...uqd.onion).hiddenServiceDirectorydirectory containing (hs_ed25519_secret_key,hs_ed25519_public_key,hostname) (created usingfs.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.