@threadbase-sh/streamer 1.56.0 → 1.58.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.
@@ -0,0 +1,47 @@
1
+ -- Bind a paired device's identity to a key instead of a string (E2EE Phase 2).
2
+ -- See specs/end-to-end-encryption/design.md §2.5.
3
+ --
4
+ -- WHY THIS IS A RUNTIME MIGRATION, since design.md originally said otherwise.
5
+ -- The design proposed `016_add_device_e2ee.sql` beside `migrations/011_create_devices.sql`,
6
+ -- which was where `devices` lived when it was written. The table has since moved
7
+ -- to runtime.db, and the distinction is load-bearing rather than cosmetic:
8
+ -- cache.db is the file `tb-streamer cache clear` deletes and the integrity
9
+ -- monitor rebuilds, because everything in it is regenerable from ~/.claude and
10
+ -- ~/.codex. A pinned static key is not. Putting these columns on the cache side
11
+ -- would mean a routine cache clear silently dropped every device's pinned key
12
+ -- while leaving that device's *authentication* intact here -- so the devices
13
+ -- keep working, unencrypted, with nothing anywhere reporting an error. That is
14
+ -- the worst available failure shape for this feature: it degrades security
15
+ -- silently and looks healthy.
16
+ --
17
+ -- Additive by construction. Nothing is altered and nothing is backfilled, so
18
+ -- every row that predates this reads as e2ee_static_pub IS NULL and
19
+ -- e2ee_required = 0, and authenticates exactly as it does today.
20
+
21
+ -- The device's Noise static public key, raw 32 bytes as base64. This becomes
22
+ -- the authoritative device identity: a device proves who it is by completing a
23
+ -- handshake against this key, rather than by presenting a token anyone holding
24
+ -- the string could present. The device token remains as the credential an older
25
+ -- client presents and as the fallback path.
26
+ ALTER TABLE devices ADD COLUMN e2ee_static_pub TEXT;
27
+
28
+ -- The downgrade lock (design.md §6.3). Set inside the pairing transaction when
29
+ -- both sides completed a handshake, and never cleared by anything a client can
30
+ -- send -- clearing it requires re-pairing, which creates a new row, or an
31
+ -- explicit admin action. Without this, "we speak encryption" would be a claim
32
+ -- an intermediary could strip, and stripping it is the cheapest possible attack.
33
+ ALTER TABLE devices ADD COLUMN e2ee_required INTEGER NOT NULL DEFAULT 0;
34
+
35
+ -- Envelope version this device negotiated. Recorded rather than assumed so a
36
+ -- future version can be rolled out per device instead of per server.
37
+ ALTER TABLE devices ADD COLUMN e2ee_version INTEGER;
38
+
39
+ -- One static key is one device.
40
+ --
41
+ -- A re-pair from the same phone presents the same static key, and without this
42
+ -- it would create a second row -- so `GET /api/devices` would fill with ghosts
43
+ -- and revoking "the" device would leave its twin working. Partial, because
44
+ -- every pre-E2EE row has a NULL here and SQLite treats NULLs as distinct only
45
+ -- inside a partial index that excludes them.
46
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_devices_e2ee_static_pub
47
+ ON devices (e2ee_static_pub) WHERE e2ee_static_pub IS NOT NULL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadbase-sh/streamer",
3
- "version": "1.56.0",
3
+ "version": "1.58.0",
4
4
  "description": "PTY session management, WebSocket streaming, and REST API server for Claude Code conversations",
5
5
  "license": "MIT",
6
6
  "author": "Ronen Mars",