Skip to content

docs: specify XChaCha20-Poly1305 nonce storage in ADR 006 - #112

Merged
thiras merged 2 commits into
mainfrom
docs/adr006-nonce-storage
Apr 2, 2026
Merged

thiras merged 2 commits into
mainfrom
docs/adr006-nonce-storage

Conversation

@thiras

@thiras thiras commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ADR 006 used XChaCha20-Poly1305 for blob encryption and key wrapping but omitted how the 24-byte nonce is stored/transmitted — clients could not decrypt without it
  • All XChaCha20-Poly1305 outputs now use an explicit nonce || ciphertext || tag wire format (nonce prepended to AEAD output)
  • Updated pseudocode, client decryption flow, mermaid diagrams, and offline playback flowchart to show nonce generation and parsing

Test plan

  • Read ADR 006 end-to-end and confirm every XChaCha20-Poly1305 usage has an explicit nonce
  • Verify BLAKE3 content-addressing is unaffected (hash covers prepended nonce)
  • Check cross-ADR consistency — no other ADRs reference ADR 006 encryption pseudocode directly

🤖 Generated with Claude Code

…R 006

ADR 006 omitted how the 24-byte nonce is stored and transmitted for both
blob encryption and key wrapping. Without this, clients cannot decrypt.
All XChaCha20-Poly1305 outputs now use an explicit nonce || ciphertext || tag
wire format with the nonce prepended to the AEAD output.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 2, 2026 04:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR clarifies ADR 006’s XChaCha20-Poly1305 usage by explicitly specifying how the 24-byte nonce is stored/transmitted so clients can reliably decrypt blobs and wrapped keys.

Changes:

  • Define a consistent wire format for all XChaCha20-Poly1305 outputs: nonce (24B) || AEAD output (ciphertext||tag).
  • Update pseudocode and client decryption steps to generate, prepend, parse, and use nonces for both blob encryption and key wrapping.
  • Update mermaid sequence diagrams and the offline playback flowchart to reflect nonce handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ADR for end-to-end encryption to incorporate a 24-byte nonce into the XChaCha20-Poly1305 encryption scheme for both blob storage and per-request sealed envelopes. The documentation and sequence diagrams have been updated to reflect this change, ensuring nonce uniqueness. I have provided feedback regarding the consistent use of terminology throughout the document to avoid ambiguity between the full encrypted package and the AEAD ciphertext component.

Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved
Address review feedback: "impossible" was too strong for a probabilistic
claim. Also clarify wire format description to avoid overloading the term
"ciphertext" between the variable and the AEAD component.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thiras
thiras merged commit 84ab33f into main Apr 2, 2026
@thiras
thiras deleted the docs/adr006-nonce-storage branch April 2, 2026 04:25
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.

2 participants