hbeam 0.1.8 → 0.1.9-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -38
- package/dist/cli.mjs +1136 -160
- package/dist/cli.mjs.map +1 -1
- package/dist/package-X2lgVM8R.mjs +6 -0
- package/dist/package-X2lgVM8R.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/package-CsWKuqOT.mjs +0 -6
- package/dist/package-CsWKuqOT.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A 1-to-1 end-to-end encrypted pipe over [HyperDHT](https://github.com/holepunchto/hyperdht).
|
|
4
4
|
|
|
5
|
-
Pipe data between two machines through a peer-to-peer encrypted tunnel. No server, no accounts.
|
|
5
|
+
Pipe data between two machines through a peer-to-peer encrypted tunnel. No server, no accounts. By default, hbeam uses your persistent identity; use `--temp` for one-time passphrase sessions.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -12,55 +12,40 @@ npm install -g hbeam
|
|
|
12
12
|
|
|
13
13
|
## CLI
|
|
14
14
|
|
|
15
|
-
### Send
|
|
15
|
+
### Send (identity by default)
|
|
16
16
|
|
|
17
|
-
Pipe data in and hbeam
|
|
17
|
+
Pipe data in and hbeam announces using your persistent identity (created on first use at `~/.config/hbeam/identity.json`):
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
echo 'hello world' | hbeam
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
```
|
|
24
|
-
HBEAM ·····
|
|
25
|
-
PASSPHRASE
|
|
26
|
-
nbsk4wlqmfuw...
|
|
27
|
-
```
|
|
28
|
-
|
|
29
23
|
### Receive
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
Connect a Beam stream by saved name:
|
|
32
26
|
|
|
33
27
|
```bash
|
|
34
|
-
hbeam
|
|
28
|
+
hbeam connect workserver
|
|
35
29
|
```
|
|
36
30
|
|
|
37
|
-
###
|
|
31
|
+
### One-time passphrase mode
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
Use `--temp` when you want a throwaway passphrase flow:
|
|
40
34
|
|
|
41
35
|
```bash
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Listen with a persistent identity
|
|
36
|
+
# Generate and announce a one-time passphrase
|
|
37
|
+
echo 'hello world' | hbeam --temp
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
# Reuse a known passphrase and announce on it
|
|
40
|
+
echo 'hello again' | hbeam <passphrase> --temp
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
hbeam
|
|
42
|
+
# Connect to an existing passphrase
|
|
43
|
+
hbeam <passphrase>
|
|
51
44
|
```
|
|
52
45
|
|
|
53
|
-
```
|
|
54
|
-
HBEAM ·····
|
|
55
|
-
PUBLIC KEY
|
|
56
|
-
a1b2c3d4e5f6...
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Share your public key once — peers can reconnect any time without a new passphrase.
|
|
60
|
-
|
|
61
46
|
### Address book
|
|
62
47
|
|
|
63
|
-
Save peers by name so you
|
|
48
|
+
Save peers by name so you do not have to remember public keys:
|
|
64
49
|
|
|
65
50
|
```bash
|
|
66
51
|
# Add a peer
|
|
@@ -99,6 +84,75 @@ hbeam whoami
|
|
|
99
84
|
a1b2c3d4e5f6...
|
|
100
85
|
```
|
|
101
86
|
|
|
87
|
+
### Expose - TCP over P2P
|
|
88
|
+
|
|
89
|
+
Expose a local TCP service to a remote peer:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Reverse proxy: expose localhost:3000 using your identity
|
|
93
|
+
hbeam expose 3000
|
|
94
|
+
|
|
95
|
+
# Reverse proxy: expose localhost:3000 with a one-time passphrase
|
|
96
|
+
hbeam expose 3000 --temp
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
HBEAM ···
|
|
101
|
+
|
|
102
|
+
ANNOUNCING
|
|
103
|
+
a1b2c3d4e5f6...
|
|
104
|
+
ONLINE [96.9.225.80:34725]
|
|
105
|
+
FORWARDING localhost:3000
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Access a remote peer's service locally:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Open a remote app from a saved peer in your browser
|
|
112
|
+
hbeam open workserver
|
|
113
|
+
|
|
114
|
+
# Open a remote app by passphrase (one-time mode)
|
|
115
|
+
hbeam open <passphrase> --temp
|
|
116
|
+
|
|
117
|
+
# Open on a specific local port
|
|
118
|
+
hbeam open workserver -p 8080
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
HBEAM ···
|
|
123
|
+
|
|
124
|
+
CONNECTING workserver
|
|
125
|
+
ONLINE [96.9.225.80:34725]
|
|
126
|
+
OPENED http://127.0.0.1:8080/
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Any TCP traffic (HTTP, SSH, databases, etc.) can be tunneled. Both sides are end-to-end encrypted via Noise.
|
|
130
|
+
|
|
131
|
+
### Gateway - local HTTP router for peers
|
|
132
|
+
|
|
133
|
+
Run a local HTTP gateway that maps `{peer}.localhost` to remote peers over P2P:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Start gateway on port 9000
|
|
137
|
+
hbeam gateway -p 9000
|
|
138
|
+
|
|
139
|
+
# Browser or curl traffic routed to address-book peer "workserver"
|
|
140
|
+
open http://workserver.localhost:9000/
|
|
141
|
+
curl http://workserver.localhost:9000/health
|
|
142
|
+
|
|
143
|
+
# Route directly to a raw public key
|
|
144
|
+
curl http://a1b2c3d4e5f6...localhost:9000/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
You can also run gateway in one-time mode:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
hbeam gateway -p 9000 --temp
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The gateway resolves subdomains with the same target rules as `hbeam open`: hex public key, address-book name, then passphrase.
|
|
154
|
+
Use this when you want one long-running local router for multiple peers. For single-peer app access, use `hbeam open`.
|
|
155
|
+
|
|
102
156
|
### Serve a single file
|
|
103
157
|
|
|
104
158
|
Serve one file over an encrypted hbeam session:
|
|
@@ -107,10 +161,10 @@ Serve one file over an encrypted hbeam session:
|
|
|
107
161
|
hbeam serve ./report.pdf
|
|
108
162
|
```
|
|
109
163
|
|
|
110
|
-
This
|
|
164
|
+
This serves from your persistent identity by default. For one-time passphrase mode instead:
|
|
111
165
|
|
|
112
166
|
```bash
|
|
113
|
-
hbeam serve ./report.pdf --
|
|
167
|
+
hbeam serve ./report.pdf --temp
|
|
114
168
|
```
|
|
115
169
|
|
|
116
170
|
On the receiving side, connect normally (`hbeam <passphrase>` or `hbeam connect <name>`). hbeam detects the incoming file header and prompts where to save it. Use `-o` to skip the prompt:
|
|
@@ -129,23 +183,30 @@ hbeam <passphrase> > report.pdf
|
|
|
129
183
|
### Options
|
|
130
184
|
|
|
131
185
|
```
|
|
132
|
-
-
|
|
186
|
+
-t, --temp Use one-time passphrase mode
|
|
133
187
|
-o, --output Save incoming file to a specific path
|
|
188
|
+
-p, --port Local listen port (open/gateway mode)
|
|
189
|
+
--host Target/listen host (expose mode, default: localhost)
|
|
134
190
|
-h, --help Show help
|
|
135
191
|
-v, --version Show version
|
|
136
192
|
```
|
|
137
193
|
|
|
138
194
|
## How it works
|
|
139
195
|
|
|
196
|
+
Identity mode (default):
|
|
197
|
+
|
|
198
|
+
1. A persistent Noise keypair is loaded from `~/.config/hbeam/identity.json` (or created on first use).
|
|
199
|
+
2. A HyperDHT node announces (server) or connects (client) using that keypair.
|
|
200
|
+
3. The Noise protocol negotiates an encrypted session between the two peers.
|
|
201
|
+
4. Data flows through a `streamx` duplex stream - stdin/stdout on the CLI, or any readable/writable in code.
|
|
202
|
+
|
|
203
|
+
One-time mode (`--temp`):
|
|
204
|
+
|
|
140
205
|
1. A 32-byte random seed is generated and encoded as a base32 passphrase.
|
|
141
|
-
2. A Noise keypair is deterministically derived from
|
|
206
|
+
2. A Noise keypair is deterministically derived from that passphrase using `sodium-universal`.
|
|
142
207
|
3. An ephemeral HyperDHT node announces (server) or connects (client) using that keypair.
|
|
143
|
-
4. The Noise protocol negotiates an encrypted session between the two peers.
|
|
144
|
-
5. Data flows through a `streamx` duplex stream — stdin/stdout on the CLI, or any readable/writable in code.
|
|
145
|
-
|
|
146
|
-
When using identity mode (`--listen` without a passphrase, or `connect`), a persistent keypair is loaded from `~/.config/hbeam/identity.json` instead of deriving one from a passphrase. The connection is still end-to-end encrypted via Noise.
|
|
147
208
|
|
|
148
|
-
All traffic is end-to-end encrypted. The DHT is only used for peer discovery; it never sees
|
|
209
|
+
All traffic is end-to-end encrypted. The DHT is only used for peer discovery; it never sees plaintext.
|
|
149
210
|
|
|
150
211
|
## Requirements
|
|
151
212
|
|