Skip to content

Conversation

@icook
Copy link
Owner

@icook icook commented Dec 17, 2025

Summary

  • Adds draft ADR-006 documenting the approach for MVP key recovery
  • Password-encrypted root key stored on server, client-side decryption into WebCrypto
  • Documents threat model, browser requirements, and alternatives considered

Key Decisions

  • Canonical encoding stays in Rust/WASM - Browser uses compiled WASM for message canonicalization
  • WebCrypto for signing - Import decrypted key as extractable: false CryptoKey
  • extractable: false is footgun reduction, not a security boundary - Prevents accidental export but doesn't protect against XSS

Open Questions (WIP)

  • Specify exact KDF (Argon2id vs PBKDF2) and parameters
  • Define fallback path for browsers without Ed25519 WebCrypto
  • Clarify re-backup flow when key is non-extractable
  • Document behavior on decryption failure (wrong password vs corruption)

Test plan

  • Review ADR content for accuracy and completeness
  • Validate threat model assumptions with security review

Closes #180

🤖 Generated with Claude Code

@icook icook force-pushed the docs/180-webcrypto-key-recovery-adr branch 3 times, most recently from b8aceb4 to 5719237 Compare December 18, 2025 20:03
@icook icook marked this pull request as ready for review December 18, 2025 20:31
icook and others added 5 commits December 19, 2025 23:06
Draft ADR documenting the approach for MVP key recovery:
- Password-encrypted root key stored on server
- Client-side decryption and WebCrypto import as non-extractable
- Separation: Rust/WASM for canonicalization, WebCrypto for signing

Refs #180

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Comprehensive spec covering:
- Dependencies (Rust and JS)
- Database schema migration
- API endpoints with rate limiting
- Encrypted backup binary format
- Frontend architecture (Worker, IndexedDB, feature detection)
- WASM canonicalization module
- 6-phase implementation plan
- Testing strategy with E2E examples
- Security considerations and CSP
- Open questions for team discussion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
New ADR establishing ZIP215 as canonical Ed25519 verification rules:
- All verification must use ZIP215 (eliminates cross-impl divergence)
- Browser verification must use WASM, not WebCrypto verify()
- Use ed25519-consensus crate for ZIP215 compliance

Updates to ADR-006:
- Cross-reference ADR-007
- Clarify verification uses WASM only
- Update fallback to use WASM module

Updates to impl spec:
- Replace ed25519-dalek with ed25519-consensus
- Expand WASM module to include sign/verify functions
- Update WasmFallbackSigner to use WASM module

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Benefits over columns on accounts:
- No NULLs on core accounts table (backup is optional)
- Clean domain separation
- Future extensibility (multiple backup methods, history)
- Can relax UNIQUE constraint later for backup versioning

Schema includes:
- Denormalized kid for join-free recovery lookup
- ON DELETE CASCADE for cleanup
- UNIQUE constraints for 1:1 MVP relationship

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add encrypted backup storage infrastructure for the key recovery feature:

- Create account_backups table migration with FK to accounts, unique
  constraints on account_id and kid, and CASCADE delete
- Implement BackupRepo trait with PgBackupRepo for database operations
- Add HTTP handlers for POST/GET/DELETE /auth/backup endpoints
- Wire BackupRepo into main.rs as Extension layer
- Add 9 integration tests covering CRUD, duplicates, and cascade delete
- Update implementation spec with Phase 1 completion status

The backup endpoints accept encrypted backup blobs and parse envelope
metadata (version, KDF algorithm, salt) for indexing. Authentication
for create/delete endpoints is deferred to a later phase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@icook icook force-pushed the docs/180-webcrypto-key-recovery-adr branch from 5719237 to 1cbc887 Compare December 20, 2025 05:08
@github-actions
Copy link
Contributor

📊 CI Reports

Report Link
📊 Coverage https://icook.github.io/tiny-congress/pr/182/coverage/
📚 Storybook https://icook.github.io/tiny-congress/pr/182/storybook/
🎭 Playwright https://icook.github.io/tiny-congress/pr/182/playwright/
📋 API Schemas GraphQL · OpenAPI

🤖 Reports auto-generated from commit 8900d01

github-actions bot added a commit that referenced this pull request Dec 20, 2025
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.

[Crypto] ADR for password-encrypted server backup of root key with WebCrypto

2 participants