Skip to content

Correct sealed-envelope comments: the daemon owns replay, the relay stores nothing - #3

Open
Jhazy33 wants to merge 1 commit into
KenKaiii:mainfrom
Jhazy33:docs/daemon-owns-replay
Open

Jhazy33 wants to merge 1 commit into
KenKaiii:mainfrom
Jhazy33:docs/daemon-owns-replay

Conversation

@Jhazy33

@Jhazy33 Jhazy33 commented Aug 14, 2026

Copy link
Copy Markdown

Comment-only fix, spotted while drafting the multi-machine design sketch in #2.

The Envelope docs (crypto.ts, wire.ts) and the envelopeHeader doc (channel.ts) still claim the relay keeps an ordered event log so a reconnecting phone can catch up, and that this is why sid/seq are readable in cleartext. That has never been the relay's job: it reads only the sender's device id for routing, stores nothing, and catch-up is the daemon answering the phone's cursors from its own ordered session log (catchUp).

The corrected comments state the real reasons the fields are cleartext:

  • ctr must be readable — the per-sender replay window is checked before decryption;
  • sid/seq are AEAD-bound so a captured frame cannot be re-addressed to another session or position; the cleartext copy is useful for diagnosing traffic without the key.

No behaviour change; the suite is untouched.

…tores nothing

The Envelope and envelopeHeader docs in crypto.ts, wire.ts and channel.ts still
say the relay keeps an ordered log so a reconnecting phone can catch up. The
relay never did that: it reads only the sender's device id, stores nothing, and
catch-up is the daemon answering the phone's cursors from its own session log.
State why sid/seq are cleartext at all (AEAD-bound against re-addressing,
readable for diagnosis) and why ctr must be readable (replay window is checked
before decryption). Comment-only change, spotted while sketching the
multi-machine design in #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant