LogoLogo
  • Pear by Holepunch
  • Pear runtime
    • Command-Line-Interface (CLI)
    • Application-Programming-Interface (API)
    • Application Configuration
  • Bare reference
    • Overview
    • Application-Programming-Interface (API)
    • Node.js Compatibility with Bare
    • Bare Modules
  • Guides
    • Getting Started
    • Starting a Pear Desktop Project
    • Making a Pear Desktop Application
    • Starting a Pear Terminal Project
    • Making a Pear Terminal Application
    • Sharing a Pear Application
    • Marking a Release
    • Making a Bare Mobile Application
    • Debugging a Pear Terminal Application
    • Creating a Pear Init Template
  • Building blocks
    • Hypercore
    • Hyperbee
    • Hyperdrive
    • Autobase
    • HyperDHT
    • Hyperswarm
  • How-tos
    • Connect two peers
    • Connect many peers
    • Replicate & persist
    • Manage multiple Hypercores
    • Share append-only databases
    • Create a p2p filesystem
  • Helpers
    • Corestore
    • Localdrive
    • Mirrordrive
    • Secretstream
    • Compact encoding
    • Protomux
  • Tools
    • Hypershell
    • Hypertele
    • Hyperbeam
    • Hyperssh
    • Drives
  • Apps
    • Keet
  • Examples
    • Bare on Mobile
    • React App using Pear
Powered by GitBook

Copyright © 2024 - 2025 Holepunch, S.A. de C.V. All rights reserved.

On this page
  • Installation
  • Basic usage
  • CLI
  • API
  1. Tools

Hyperbeam

Last updated 1 year ago

An end-to-end encrypted pipeline for the Internet, utilizing the and Noise Protocol for secure communications.

Installation

Install with :

npm install hyperbeam

Basic usage

const Hyperbeam = require('hyperbeam')

// to generate a passphrase, leave the constructor empty 
a passphrase
const beam = new Hyperbeam()

// Use the following constructor with ('neznr3z3j44l7q7sgynbzpdrdlpausurbpcmqvwupmuoidolbopa') a 32-byte unique passphrase
// to find the other side of the pipe.
// const beam = new Hyperbeam('neznr3z3j44l7q7sgynbzpdrdlpausurbpcmqvwupmuoidolbopa')

// beam.key gives the passphrase
console.log('passphrase: ',beam.key)

// make a little chat app
process.stdin.pipe(beam).pipe(process.stdout)

CLI

Step 1: Install Hyperbeam as a global npm package.

npm install -g hyperbeam

Step 2: Generate a passphrase, using the following command on a machine

echo 'hello world' | hyperbeam

e.g. output: neznr3z3j44l7q7sgynbzpdrdlpausurbpcmqvwupmuoidolbopa

Step 3: Then on another machine run the following command

# will print 'hello world'
hyperbeam neznr3z3j44l7q7sgynbzpdrdlpausurbpcmqvwupmuoidolbopa

API

const stream = new Hyperbeam([key][, options])

Makes a new Hyperbeam duplex stream.

This stream will auto-connect to another peer using the same key with an end-to-end encrypted tunnel. When the other peer writes it's emitted as data on this stream. Likewise, writes to this stream stream are emitted as data on the other peer's stream.

If a key is not passed into the constructor (the passphrase), one will be generated and put on stream.key

options include:

Option
Description

dht

A DHT instance. Defaults to a new instance

stream.key

The passphrase used by the stream for connection.

Hyperswarm
GitHub (Hyperbeam)
npm
Installation
Basic usage
CLI
API