Repository navigation
Proposal 0001, step 2: KeyVault port (persistent device identity) #10
Replies: 1 comment
|
This is a well-targeted next step for Step 2 of the migration plan. Defining a clean KeyVault port directly 1. Identity and Sequence Numbers Lifecycle: Store Guard vs. Vault Sequence Tracking│ Recommendation: Store records owner_pubkey in local_state; engine refuses to author on mismatch or empty store 2. Device-Only Storage (Preventing Multi-Device Clones)Fully agree. Two devices operating with the same seeds will inevitably cause sequence forking and mesh 3. The Flutter Vault: Native Implementation vs. Dependency│ Recommendation: (b) Native implementation in msgp2p_flutter as default, keeping (c) open via interface. 4. Where FileKeyVault Lives│ Recommendation: A small msgp2p_keyvault_file package (or msgp2p_vault_file). • §4 of Proposal 0001 rightly targets a pure-Dart msgp2p_core that has zero I/O assumptions and can run on 5. Feedback on Proposed API & Contract SuiteThe API definition is clean and minimal: • Contract Test Suite additions: |
Uh oh!
There was an error while loading. Please reload this page.
Step 2 of the migration plan in proposal 0001 (§7): a
KeyVaultport so that a node keeps the same identity across restarts, as FR-ID-01 requires.Problem
MsgP2PNode.initializederives the Ed25519 signing key and the X25519 Noise key fromsigningSeed/noiseSeed, and makes fresh random seeds when the host passes none. A host that forgets to persist them gets a new identity at every start. FR-ID-01 asks for keys wrapped by Android Keystore / iOS Keychain, but no code provides that.Proposed API (in
msgp2p_core)MsgP2PNode.initialize(keyVault: ...);signingSeed/noiseSeedstay accepted for one minor version (deprecated).MemoryKeyVault(tests), a file vault with 0600 permissions (Linux / CLI nodes), and a keystore vault inmsgp2p_flutter.erasethenloadOrCreategives a new identity, concurrent first calls create one identity, a corrupt or unreadable vault throws a typed error (never silently creates a new identity).Points to decide
seqcounter is kept in the store (local_state), the keys in the vault. If the store is wiped but the keys are kept, the node starts again atseq = 1with the same author key and produces different envelopes for(author, seq)pairs that peers already hold. Proposal: the store records the member public key it belongs to; on start, if the vault's key and the store's key differ (or the store is empty but the vault is not new), the engine refuses to author until the host either erases the vault (new identity) or restores the store. Alternatively the vault also persists the highest usedseq. Which do we prefer?(author, seq)pairs. So the keystore vault must use device-only storage: iOS KeychainkSecAttrAccessibleAfterFirstUnlockThisDeviceOnly(no iCloud Keychain, not restored to a new phone) and Android Keystore with the app's data excluded from backup. A restored or new device starts with a new identity and asks the server for a new certificate.msgp2p_flutterdepends onflutter_secure_storage; (b) the plugin stores the seeds itself (Kotlin: Keystore-wrapped AES-GCM key; Swift: Keychain item), keeping the thin-native rule (byte storage only, no protocol logic); (c) no default, and every host brings its own. Proposal: (b), with (c) always possible through the interface.msgp2p_core(it already importsdart:iofor the gateway today, but §4 of the proposal aims for a core without I/O choices) or in a smallmsgp2p_keyvault_filepackage. Proposal: a small package, consistent with §4.Out of scope
Key rotation of the device identity (a new identity is simply a new member with a new certificate), and hardware-backed signing (the Ed25519 key is used in Dart; only its seed is protected at rest).
All reactions