feat: B2 wallet device registry (stateless, encrypted, blind relay)#48
Merged
Conversation
…n (Go+JS+vector) K_reg = HKDF-SHA256(wallet_secret, salt 'miranda/registry/v1'); records are ChaCha20-Poly1305 sealed with machine_id as AAD (encryption AND authenticity: a forged blob fails to open). Byte-identical Go<->JS, gated by testdata/registry-vector.json (cross-checked vs Python cryptography). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…+ GET /registry)
Agents publish an opaque encrypted device blob as the first message on their
live /agent/signal registration; the relay holds it in-memory on the agentConn
(no persistence) and serves GET /registry?wallet=W -> [{machine_id, blob}] for
the live agents under W. It never decrypts, verifies, or persists — blind and
stateless; a relay restart loses it and agents re-publish on reconnect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… registry record
A wallet-rooted mir up auto-pins its own wallet (your own devices need no
pairing) and publishes a ChaCha20-Poly1305-sealed {name,host_pub,signal_url,ts}
record on its live /agent/signal registration, re-published on each reconnect.
Legacy (wallet-less) mir up is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…chines + notify mir list and mir attach <name> fetch the relay's encrypted registry, decrypt with the wallet (forgeries dropped), and merge with local machines.json — no add-machine needed for your own devices. A newly-seen machine_id prints a one-line "new device joined" notice (seen-set in seen.json). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… notify Sign-in keeps the prf secret in memory so the session can derive K_reg; the machine view renders the local list immediately, then enriches it from GET /registry?wallet= (same-origin, best-effort): decrypt each blob with the wallet (forgeries dropped), merge (local wins), and show a one-line "new device joined" notice. Discovery only — attach path unchanged. Verified in-browser: sign-in → machine list renders, no errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A real-relay e2e: an agent seals a record + base64s it onto its live registration, the relay serves it verbatim (blind), and the fetcher base64-decodes + OpenRecords it (machine_id AAD) to recover the record — a forgery is dropped, a fresh relay is empty (stateless). Catches cross- component contract drift the per-slice fixtures can't. README documents auto-discovery; SECURITY documents the encrypted/blind/stateless registry. Deploy of the new mir-signal (/registry endpoint) is Fredrik's hand. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
docs/superpowers/specs/2026-06-14-b2-device-registry-design.md. Your machinesappear everywhere by name, attachable with no
add-machineand no SAS — the payoffof the wallet identity, and it kills the re-pair-every-machine friction.
How it works
Each
mir up(with your wallet) seals an encrypted record{name, host_pub, signal_url, ts}under
K_reg = HKDF(wallet_secret, "miranda/registry/v1")and attaches it to its live/agent/signalregistration. The relay holds it in-memory (no DB, no disk) and servesGET /registry?wallet=W → [{machine_id, blob}]. Clients + browser fetch, AEAD-open (forgeriesself-drop), and auto-list. Discovery only — B1.4 acceptance + offline LAN-direct unchanged.
Stays true to the thesis (your decisions)
on reconnect (like today's live registrations). A fresh relay is empty.
machine_idasAAD: a forged blob fails to open → dropped; the relay verifies/decrypts/persists nothing.
mir upself-publishes and works immediately;a newly-seen machine prints "📣 new device joined".
Slices (all TDD)
RegistryKey+ ChaCha20-Poly1305 seal/open, Go+JS,testdata/registry-vector.json(cross-checked vs Python
cryptography— 3 independent impls agree).GET /registry(blind, stateless,-raceclean).mir upauto-pins its own wallet (own devices need no pairing) + publishes.mir list/attachfetch+decrypt+merge (local wins) + notify.list renders, registry fetch best-effort).
relay empty) + README/SECURITY.
Trade-off (accepted)
Online-only discovery — a powered-off machine reappears when it reconnects. Revocation = power
off, or rotate the wallet for a leaked phrase.
pair/add-machinekept for cross-wallet.Your hand
Deploy of the new
mir-signal(adds/registry+ the opaqueRegistrypassthrough —additive, backward-compatible: old clients ignore it) is live-infra, health-gated.
🤖 Generated with Claude Code