Skip to content

docs: add ADR 012 (client architecture) and move key delivery to iroh QUIC - #162

Merged
thiras merged 5 commits into
mainfrom
adr-012-client-architecture
Apr 3, 2026
Merged

thiras merged 5 commits into
mainfrom
adr-012-client-architecture

Conversation

@thiras

@thiras thiras commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds ADR 012 defining client architecture as a canonical specification, consolidating client behaviour scattered across ADRs 001, 003, 005, 006, and 008
  • Resolves the open eclipse attack question in ADR 003 (Option B for production, registry-only for PoC, Option C as supplementary policy)
  • Moves key delivery from WebSocket/SSE to a new cdn/keys/v1 iroh QUIC ALPN, dropping crypto_box_seal and the X25519 key from the client's key set

Closes #144

ADR 012 covers

  • Bootstrap procedure — full startup sequence from key loading through gossip subscription and periodic registry refresh
  • Key management — iroh Ed25519 (identity + QUIC auth) and Ethereum secp256k1 (payments/vouchers); PoC vs. production storage; hardware wallet feasibility analysis
  • Identity lifecycle — ephemeral per-connection NodeId-to-Ethereum bindings; key rotation; key compromise response
  • Eclipse attack mitigation — Option B (multi-source bootstrap) for production; Option C (min peer diversity) as supplementary
  • Trust boundary — three-tier classification (verified/trusted/not trusted)
  • Client configuration — ~/.decdn/ directory structure and TOML config defaults

Key delivery redesign (ADR 006 + cross-cutting)

The app server now communicates with clients over cdn/keys/v1 iroh QUIC instead of WebSocket/SSE. Three stream types on a single connection:

  1. Epoch key stream (long-lived) — replaces WebSocket persistent connection
  2. Play request (short-lived) — replaces POST /play
  3. Offline lease request (short-lived) — replaces POST /offline/lease

QUIC TLS 1.3 provides confidentiality and mutual authentication, eliminating crypto_box_seal and the X25519 key. Clients now manage two keys (iroh + Ethereum) instead of three. iroh key rotation is seamless — reconnect with new NodeId, re-authenticate with session token, no sealed envelopes to invalidate.

Files changed

File Change
adr/012-client.md New — client architecture ADR
adr/006-e2e-encryption.md Key delivery → cdn/keys/v1; drop crypto_box_seal; simplify decryption flow
adr/005-protocol.md Add cdn/keys/v1 to ALPN + stream concurrency tables
adr/architecture.md ADR 012 entry; diagram; ALPN table; external components section
adr/003-payments.md Eclipse attack resolution note
CLAUDE.md ALPN table

Test plan

  • Verify crypto_box_seal no longer appears as active protocol (only in "not needed" context)
  • Verify no remaining WebSocket/SSE references for key delivery
  • Verify X25519 removed from ADR 012 key management
  • Verify cdn/keys/v1 appears consistently across ADRs 005, 006, 012, and architecture.md
  • Verify all [ADR NNN](NNN-*.md) cross-references resolve
  • Review ADR 006 client decryption flow no longer has "unseal" step
  • Review architecture.md diagram labels match new protocol

🤖 Generated with Claude Code

Closes #144. Clients are referenced throughout ADRs 001-011 but no ADR
defined how they discover the network, manage keys, or what their trust
assumptions are. This ADR consolidates client behaviour into a canonical
spec covering bootstrap procedure, key management (iroh Ed25519 +
Ethereum secp256k1 + derived X25519), ephemeral identity lifecycle,
eclipse attack resolution (Option B for production, registry-only for
PoC), and an explicit three-tier trust boundary. Also resolves the open
eclipse attack question in ADR 003 and adds the ADR 012 entry to
architecture.md.

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

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

Adds ADR 012 to consolidate and canonically specify client behavior (bootstrap, keys, identity lifecycle, eclipse mitigation, and trust boundary), and updates existing ADR index/notes to reflect the new decision.

Changes:

  • Add new ADR 012 detailing client architecture, bootstrap procedure, key management, identity lifecycle, eclipse-attack mitigation decision, and trust boundary.
  • Update adr/architecture.md to include ADR 012 in the architecture/ADR index.
  • Update ADR 003 to note that the eclipse-attack option decision is resolved in ADR 012.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
adr/architecture.md Adds ADR 012 entry to the architecture ADR index and summarizes its scope.
adr/012-client.md Introduces ADR 012 with the consolidated client specification (bootstrap, keys, identity, eclipse mitigation, trust model, config).
adr/003-payments.md Adds a resolution note pointing eclipse-attack decision-making to ADR 012.

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

Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/architecture.md Resolved
Comment thread adr/012-client.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 introduces ADR 012, which establishes a comprehensive specification for client architecture, bootstrap procedures, and trust boundaries. It consolidates client behaviors previously scattered across other ADRs and resolves the eclipse attack mitigation strategy by adopting a multi-source bootstrap for production. The review feedback suggests enhancing security by encrypting the iroh secret key in PoC environments and using domain-separated messages for hot key derivation to prevent replay attacks. Additionally, it recommends using the on-chain registry as the canonical source for peer addresses and refining technical terminology regarding backoff strategies for better precision.

Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Replace WebSocket/SSE key delivery with a new cdn/keys/v1 ALPN on iroh
QUIC. The app server now communicates with clients over authenticated
QUIC streams instead of a separate WebSocket transport. This eliminates
crypto_box_seal and the X25519 key from the client's key set — QUIC
TLS 1.3 provides equivalent confidentiality and mutual authentication.

Changes across ADRs 005, 006, 012, and architecture.md:
- ADR 006: app server uses cdn/keys/v1 with three stream types (epoch
  key, play request, offline lease); envelopes are {wrapped, epoch_id,
  blob_hash} over QUIC; client decryption flow simplified
- ADR 012: X25519 key removed (two keys not three); key compromise
  table updated; trust boundary updated for cdn/keys/v1
- ADR 005: cdn/keys/v1 added to ALPN and stream concurrency tables
- architecture.md: diagram, summaries, and external components updated

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thiras thiras changed the title docs: add ADR 012 — client architecture, bootstrap, and trust model docs: add ADR 012 (client architecture) and move key delivery to iroh QUIC Apr 3, 2026
- CLAUDE.md: update ADR range to 012-client.md, next number to 013
- ADR 006: fix stale POST /offline/lease and HTTPS reference in offline
  lease pseudocode — now references cdn/keys/v1 stream type 0x03
- architecture.md: fix ALPN count to "Five protocols" matching ADR 005

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


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

Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/006-e2e-encryption.md Resolved
@thiras

thiras commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

- Bootstrap: specify paginated getActiveNodes calls
- nonce=0 security: fix incorrect claim that on-chain requires nonce>0;
  actual protection is EIP-712 domain separator (contract addr + chain ID)
- Hot key derivation: add Ethereum address for domain separation and
  rejection sampling note for secp256k1 scalar conversion
- DNS seeds: reconcile hardcoded vs config (built-in defaults + runtime
  override); registry multiaddrs are canonical source of truth
- TOML: add note that client must perform home-directory expansion
- architecture.md: remove "Canonical" from ADR 012 summary wording

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@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 introduces ADR 012, which defines the client architecture, bootstrap process, and trust model, while refactoring ADR 006 to use a new iroh QUIC protocol (cdn/keys/v1) for key delivery instead of WebSocket/SSE. The encryption model is simplified by removing the asymmetric layer in favor of QUIC TLS 1.3. Review feedback identifies several improvement opportunities, including caching a window of epoch keys to prevent decryption failures during rotation and addressing missing App Server configuration details. Other suggestions include refining retry terminology, using generic RPC placeholders, and documenting security trade-offs for session token storage.

Comment thread adr/006-e2e-encryption.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
Comment thread adr/012-client.md Resolved
- Bootstrap: add DNS seed merge steps (4-5) for production; label PoC
  skip explicitly
- ADR 006: add authentication sequencing constraint — epoch key stream
  must be established before play/lease streams
- ADR 006: cache current + previous epoch key (not just current) to
  handle content buffered at epoch boundaries
- ADR 012: add [app_server] config section with node_id and addrs
- ADR 012: use generic RPC URL placeholder instead of Alchemy

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thiras
thiras merged commit b7412ab into main Apr 3, 2026
@thiras
thiras deleted the adr-012-client-architecture branch April 3, 2026 02:04
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.

No ADR for client architecture, bootstrap, or trust model

2 participants