@celljs/ta-relay 4.6.1 → 4.8.0
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.en.md +36 -0
- package/README.md +3 -2
- package/package.json +2 -2
package/README.en.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Cell - Ta Relay
|
|
2
|
+
|
|
3
|
+
Connect from your phone or another device to your computer's `ta serve`: both sides establish connections to Relay, which only forwards traffic. Content is end-to-end encrypted, so Relay cannot read it. This is off by default; `ta serve` only connects to Relay after you pair a device.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Mobile (RelaySocket) ──wss──▶ Relay ◀──wss── ta serve (RelayHost) ──ws──▶ localhost /api/ws
|
|
7
|
+
└──────── AES-256-GCM, key only at both ends ────────┘
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Pairing
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
ta pair # add a device, print pairing link; default Relay is https://relay.cellbang.com
|
|
14
|
+
ta pair https://<relay> --name phone # use your own Relay, name the device
|
|
15
|
+
ta pair --list # list paired devices
|
|
16
|
+
ta pair --remove <device-id> # unpair, takes effect immediately
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Pairing links look like `https://<relay>/pair#v=1&h=<host-id>&d=<device-id>&k=<key>`. The key is after the `#`, so the browser won't send it to Relay. Paste the link in the Ta app to connect. You can also pair from the Web client or desktop app: click the gear menu's "Use on your phone…" to show the link as a QR code (shown once only) and list paired devices, whether ta serve is connected to Relay, and allow you to unpair (`ta serve`'s `TaRelayServer`). Devices are saved in `relay.json` in the agent directory (file mode 0600); `ta serve` automatically reads changes as they happen, no restart needed.
|
|
20
|
+
|
|
21
|
+
## Protocol
|
|
22
|
+
|
|
23
|
+
- `/v1/host/<host-id>?secret=<host-secret>`: `ta serve` connects here. Each host ID is claimed by the first host to connect with it; Relay only stores the hash of the secret.
|
|
24
|
+
- `/v1/connect/<host-id>`: devices connect here. Relay assigns each a channel and forwards it to the host (`{t:'open'|'data'|'close', ch, d}`).
|
|
25
|
+
- Handshake: the device sends first `{t:'hello', v:1, device, nonce}`; the host finds the device's key and replies `{t:'ready', nonce, proof}`. Both sides use HKDF-SHA-256 (device key, salt is both nonces) to derive one AES-256-GCM key for each direction, ensuring every connection has a different key. `proof` is the host's first encrypted message, proving it has this device's key. After that, every message is encrypted with the IV set to the message sequence number, so Relay's replay, drop, or reorder attempts all fail decryption.
|
|
26
|
+
- The host opens one connection per device to localhost's `/api/ws`, including the localhost token. Devices never receive or need the token.
|
|
27
|
+
|
|
28
|
+
## Deploying Relay
|
|
29
|
+
|
|
30
|
+
- Cloudflare Workers: [apps/ta-relay](../../apps/ta-relay/README.md) (Durable Objects, sleep when idle).
|
|
31
|
+
- Your own machine: `ta relay [--host 0.0.0.0] [--port 8080]`, behind an HTTPS reverse proxy. Host ID ownership exists only in memory; after restart, the first host to connect reclaims it.
|
|
32
|
+
|
|
33
|
+
## Known Limitations
|
|
34
|
+
|
|
35
|
+
- When going through Relay, only WebSocket calls work. Local file preview in the Web client (`/api/files`) is not available.
|
|
36
|
+
- Device keys are long-term with no forward secrecy: if a key leaks, old traffic in recordings can be decrypted. Unpairing invalidates the key.
|
package/README.md
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
## 配对
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
ta pair https
|
|
13
|
+
ta pair # 新增一台设备,打印配对链接;默认 Relay 是 https://relay.cellbang.com
|
|
14
|
+
ta pair https://<relay> --name 手机 # 用自己的 Relay,给设备起名
|
|
14
15
|
ta pair --list # 已配对的设备
|
|
15
16
|
ta pair --remove <设备 id> # 取消配对,立即生效
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
配对链接形如 `https://<relay>/pair#v=1&h=<主机 id>&d=<设备 id>&k=<密钥>`。密钥在 `#` 之后,浏览器不会把它发给 Relay。在 Ta
|
|
19
|
+
配对链接形如 `https://<relay>/pair#v=1&h=<主机 id>&d=<设备 id>&k=<密钥>`。密钥在 `#` 之后,浏览器不会把它发给 Relay。在 Ta 应用里粘贴这个链接即可连接。Web 客户端和桌面应用里也能配对:齿轮菜单的"在手机上使用…"把链接显示成二维码(只显示一次),并列出已配对的设备、ta serve 是否连着 Relay,可以取消配对(ta serve 的 `TaRelayServer`)。设备记在 agent 目录的 `relay.json`(权限 0600),`ta serve` 运行时会自己读到改动,不用重启。
|
|
19
20
|
|
|
20
21
|
## 协议
|
|
21
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-relay",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Ta from anywhere: a relay that only forwards, and end-to-end encryption between a paired device and ta serve",
|
|
5
5
|
"homepage": "https://github.com/cellbang/cell",
|
|
6
6
|
"bugs": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@celljs/rpc": "4.
|
|
31
|
+
"@celljs/rpc": "4.8.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|