feat(key-storage): add independent key storage decoupled from Account#2828
feat(key-storage): add independent key storage decoupled from Account#2828jaymengxy wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Key Independent Storage & Account Decoupling — Implementation NotesBackground & GoalsProblem: Key material (mnemonic, private key, Android Keystore prefix) was previously serialized inside the Goal: Decouple all three key types from Physical Storage LayoutEach key type occupies its own dedicated directory — mirroring the original design of one SharedPreferences file per type. The encryption key is a random hex string generated once at startup and stored in ArchitectureKey Write Points
Key Read & Wallet Creation FlowOrphaned Key RecoveryWhen the account cache is lost but keys survive, These entries appear in Migration StrategyFWK Dependency Changes (
|
| Addition | Description |
|---|---|
SeedPhraseKey.Companion.load() |
Static factory — decrypts and reconstructs a SeedPhraseKey from storage without needing an existing instance |
CryptoProviderKey.saveProviderIdentifier() |
Encrypt and persist an opaque provider identifier |
CryptoProviderKey.getProviderIdentifier() |
Retrieve and decrypt a stored provider identifier |
CryptoProviderKey.hasProviderIdentifier() |
Lightweight existence check (no decryption) |
AndroidKeystoreKey |
Removed — superseded by CryptoProviderKey.companion |
Related FWK PR: onflow/Flow-Wallet-Kit#83
Summary
KeyStorageManagerandKeyStorageMigrationto store mnemonic / private key / Android Keystore prefix independently of theAccountobjectWalletCreationHelper,CryptoProviderManager,AuthBridgeHandler,NativeFRWBridge,KeyStoreRestoreViewModelto write to / read from new storagebuildLocalKeyAccounts()inAccountManagerto surface recoverable accounts whose key survives but Account cache was lostflow-wallet-android0.2.1 → 0.2.4 (picks upSeedPhraseKey.load()andCryptoProviderKeyidentifier storage helpers)Test Plan
frw_sp_storage/and survives app-cache clearfrw_pk_storage/and survives app-cache clearfrw_akp_storage/and wallet recreates correctlyLocalSwitchAccountcompletes login and re-adds account normally🤖 Generated with Claude Code