hbeam 0.1.7 → 0.1.8-alpha.10

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 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. Just a shared passphrase or a persistent identity.
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 generates a passphrase (copied to your clipboard):
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
- Pass the passphrase on the other machine to receive:
25
+ Connect by saved name or public key:
32
26
 
33
27
  ```bash
34
- hbeam nbsk4wlqmfuw...
28
+ hbeam connect workserver
35
29
  ```
36
30
 
37
- ### Listen with a known passphrase
31
+ ### One-time passphrase mode
38
32
 
39
- Re-use a specific passphrase with `--listen`:
33
+ Use `--temp` when you want a throwaway passphrase flow:
40
34
 
41
35
  ```bash
42
- echo 'hello again' | hbeam <passphrase> --listen
43
- ```
36
+ # Generate and announce a one-time passphrase
37
+ echo 'hello world' | hbeam --temp
44
38
 
45
- ### Listen with a persistent identity
39
+ # Reuse a known passphrase and announce on it
40
+ echo 'hello again' | hbeam <passphrase> --temp
46
41
 
47
- Listen on a stable public key instead of a one-off passphrase. Your identity is created automatically on first use and stored at `~/.config/hbeam/identity.json`:
48
-
49
- ```bash
50
- hbeam --listen
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 don't have to remember public keys:
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,47 @@ 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
+ # Forward proxy: connect to a saved peer, listen on local port 8080
112
+ hbeam connect workserver -p 8080
113
+
114
+ # Forward proxy: connect by passphrase (one-time mode)
115
+ hbeam connect <passphrase> -p 8080 --temp
116
+ ```
117
+
118
+ ```
119
+ HBEAM ···
120
+
121
+ CONNECTING workserver
122
+ ONLINE [96.9.225.80:34725]
123
+ LISTENING 127.0.0.1:8080
124
+ ```
125
+
126
+ Any TCP traffic (HTTP, SSH, databases, etc.) can be tunneled. Both sides are end-to-end encrypted via Noise.
127
+
102
128
  ### Serve a single file
103
129
 
104
130
  Serve one file over an encrypted hbeam session:
@@ -107,10 +133,10 @@ Serve one file over an encrypted hbeam session:
107
133
  hbeam serve ./report.pdf
108
134
  ```
109
135
 
110
- This announces a one-time passphrase by default. To serve from your persistent identity instead:
136
+ This serves from your persistent identity by default. For one-time passphrase mode instead:
111
137
 
112
138
  ```bash
113
- hbeam serve ./report.pdf --listen
139
+ hbeam serve ./report.pdf --temp
114
140
  ```
115
141
 
116
142
  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 +155,30 @@ hbeam <passphrase> > report.pdf
129
155
  ### Options
130
156
 
131
157
  ```
132
- -l, --listen Listen using passphrase or identity
158
+ -t, --temp Use one-time passphrase mode
133
159
  -o, --output Save incoming file to a specific path
160
+ -p, --port Local listen port (connect forward mode)
161
+ --host Target/listen host (expose/connect mode, default: localhost)
134
162
  -h, --help Show help
135
163
  -v, --version Show version
136
164
  ```
137
165
 
138
166
  ## How it works
139
167
 
168
+ Identity mode (default):
169
+
170
+ 1. A persistent Noise keypair is loaded from `~/.config/hbeam/identity.json` (or created on first use).
171
+ 2. A HyperDHT node announces (server) or connects (client) using that keypair.
172
+ 3. The Noise protocol negotiates an encrypted session between the two peers.
173
+ 4. Data flows through a `streamx` duplex stream - stdin/stdout on the CLI, or any readable/writable in code.
174
+
175
+ One-time mode (`--temp`):
176
+
140
177
  1. A 32-byte random seed is generated and encoded as a base32 passphrase.
141
- 2. A Noise keypair is deterministically derived from the passphrase using `sodium-universal`.
178
+ 2. A Noise keypair is deterministically derived from that passphrase using `sodium-universal`.
142
179
  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
180
 
148
- All traffic is end-to-end encrypted. The DHT is only used for peer discovery; it never sees the plaintext.
181
+ All traffic is end-to-end encrypted. The DHT is only used for peer discovery; it never sees plaintext.
149
182
 
150
183
  ## Requirements
151
184