feat(vault): Dart client-side crypto core (ADR-052 D-4, mobile first)#300
Merged
Conversation
…vault First slice of the client side of ADR-052 D-4 (Dart/mobile first). Pure on-device crypto over package:cryptography — only opaque ciphertext ever leaves the device. VaultCrypto: - generateVaultKey / sealBundle / openBundle — one AES-256-GCM vault key seals the whole bundle (connections + keys + passphrases + passwords, D-3). - device keypair (X25519) + wrapForDevice / unwrapForDevice — sealed-box (ephemeral X25519 -> ECDH -> HKDF-SHA256 -> AES-GCM) so the hub relays a per-device wrapped key it can't read; deviceKeyPairFromSeed reconstructs from the persisted seed. - generateRecoveryCode (160-bit base32) + wrapForRecovery / unwrapRecovery — the vault key wrapped under a director-escrowed recovery code (Argon2id), formatting- insensitive. Argon2 cost is injectable so tests stay fast. Wire formats are base64 of packed bytes matching the hub's opaque columns. Tests cover bundle round-trip + wrong-key auth failure + fresh-nonce, device wrap/unwrap + intruder rejection + seed-reconstruction, recovery round-trip + wrong-code + format tolerance, and code shape. Flutter SDK isn't available locally (per project setup), so CI analyze+test is the validation gate. Co-Authored-By: Claude Opus 4.8 <[email protected]>
physercoe
pushed a commit
that referenced
this pull request
Jul 5, 2026
Surfaces the zero-knowledge SSH key-vault sync (ADR-052 D-4) in the mobile app end-to-end: hub blind blob store (#299), Dart crypto core (#300), VaultApi sync client, and the Settings › Data › Key vault sync flow. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of the client side of the zero-knowledge key vault (ADR-052 D-4), Dart/mobile first. All crypto happens on-device; only opaque ciphertext leaves it (the hub sync store from #299 is a blind blob store).
VaultCrypto(lib/services/vault/vault_crypto.dart)deviceKeyPairFromSeedreconstructs a device keypair from its persisted seed.generateRecoveryCode(160-bit, dash-grouped base32) +wrapForRecovery/unwrapRecovery(vault key wrapped under a director-escrowed code via Argon2id, formatting-insensitive). Argon2 cost is injectable so tests stay fast.Wire formats are base64 of packed bytes matching the hub's opaque TEXT columns:
sealed bundle = nonce‖ct‖mac,device envelope = ephPub(32)‖box,recovery envelope = salt(16)‖box.Tests
Bundle round-trip + wrong-key auth failure + fresh-nonce; device wrap/unwrap + intruder rejection + seed-reconstruction round-trip; recovery round-trip + wrong-code failure + format tolerance; recovery-code shape.
Note on verification
The Flutter/Dart SDK isn't available in this environment (per project setup), so I could not run
flutter analyze/testlocally — CI is the validation gate. The API is written againstpackage:cryptography2.9.0, matching the existing usage inlib/services/keychain/ssh_key_service.dart. If CI flags an API signature (e.g. an Argon2id param name), it's a quick fix.Follow-ups (not in this PR)
VaultApihub sync sub-client (push/pull/devices/recovery over the feat(hub): zero-knowledge SSH key-vault sync (ADR-052 D-4) + accept ADR-052 #299 endpoints).DataPortServiceconnections+keys shape; retire the cleartext backup.Depends on #299 (hub vault store) being merged for end-to-end, but this crypto core is independent and mergeable on its own.
🤖 Generated with Claude Code