Skip to main content

Spork Beam: Encrypted, Networked Pipes

· 2 min read
Paul Frazee

With Spork v1.3.1 we've added the beam command: an encrypted, networked pipe using Mafintosh's hyperbeam module.

$ npm install -g @atek-cloud/spork

Beam is very simple to use. On the first device, you'd run something like:

$ echo "SPORK POWERS!" | spork beam

This will output instructions for completing the pipe:

▶ Run the following command to connect:▶   spork beam upxtbzbcqvzlleo3vn4r3swfepk4nr7qerfksotlmssuttllxwhq▶ To restart this side of the pipe with the same key add -r to the above▶ Joined the DHT - remote address is XXX

On the second device, you'll enter:

$ spork beam upxtbzbcqvzlleo3vn4r3swfepk4nr7qerfksotlmssuttllxwhq

And soon you'll see:

▶ Connecting pipe...▶ Joined the DHT - remote address is XXX▶ Success! Encrypted tunnel established to remote peerSPORK POWERS!

Tada! Spork powers, activated.

Sending files#

Beam is quite good for sending files around:

# device 1$ cat secrets.txt | spork beam
# device 2$ spork beam $THE_KEY > secrets.txt

All the instructions are written to stderr, so there's no worry that they'll pollute your file.

Bidirectional streams#

The pipe is bidirectional, so you can send data from either device or both at the same time.

# device 1$ echo "Hi there" | spork beam
# device 2$ echo "And hello to you sir" | spork beam $THE_KEY

In fact, you can get a mini chat program going by running cat with no parameters so it reads from stdin:

# device 1$ cat | spork beam
# device 2$ cat | spork beam $THE_KEY
# chat away!

Credit to the Hypercore protocol#

Spork's magicks come from the incredible Hypercore Protocol team. Spork is really a small wrapper around Hyperswarm, their networking layer.

Hop on the Hypercore Protocol Discord if you want to dig more into the work they're doing.

Links#

Paul