Skip to content

docs: fix offline lease sealing flow and specify encryption primitive in ADR 006 - #109

Merged
thiras merged 1 commit into
mainfrom
docs/006-offline-lease-encryption-primitive
Apr 2, 2026
Merged

thiras merged 1 commit into
mainfrom
docs/006-offline-lease-encryption-primitive

Conversation

@thiras

@thiras thiras commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix incorrect flow where app server sealed leases with a non-exportable device key — server now builds the lease and returns it; the client seals locally using the platform keystore
  • Replace underspecified encrypt(device_key, lease) with AEAD_Seal(device_key, lease) reflecting opaque key handles and platform-dependent primitives (typically AES-256-GCM)
  • Update architecture.md app server responsibilities to clarify client-side sealing

Test plan

  • Verify lease issuance pseudocode correctly separates server steps (build + return) from client steps (seal + store)
  • Confirm device_key is never referenced in a server-side context across all ADRs
  • Check architecture.md summary is consistent with the updated ADR 006 flow

🤖 Generated with Claude Code

Replace underspecified encrypt(device_key, lease) with explicit
XChaCha20-Poly1305 AEAD and document platform keystore constraints
(AES-256-GCM fallback where secure elements lack XChaCha20 support).

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

@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 end-to-end encryption architecture document to specify XChaCha20-Poly1305 for sealing leases, with a fallback to AES-256-GCM on certain platforms. Review feedback identifies a logical contradiction where the server is tasked with using non-exportable hardware-backed keys and highlights the critical need for unique nonces when falling back to AES-GCM to prevent key compromise.

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

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 updates ADR 006’s offline lease sealing pseudocode to specify a concrete AEAD primitive (XChaCha20-Poly1305) and documents a platform-keystore-driven fallback (AES-256-GCM), clarifying the intended “device-bound key” security property.

Changes:

  • Replace underspecified encrypt(device_key, lease) with XChaCha20-Poly1305(device_key, lease) in the offline lease flow.
  • Add documentation about keystore-backed AEAD execution and a potential AES-256-GCM substitution.
  • Explicitly state the invariant that device_key should not leave the keystore in plaintext.

💡 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
@thiras thiras changed the title docs: specify encryption primitive for offline lease sealing in ADR 006 docs: fix offline lease sealing flow and specify encryption primitive in ADR 006 Apr 2, 2026
@thiras
thiras merged commit 968e893 into main Apr 2, 2026
4 checks passed
thiras added a commit that referenced this pull request Apr 2, 2026
Address review feedback on #109:
- Make TLS requirement normative for lease transit (plaintext K_blobs)
- Clarify desktop keystore returns key to user-space
- Use precise verb in architecture.md (builds/returns, not issues)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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