feat(services): recover orphaned Android Keystore keys via on-chain m…#3182
Open
justjoolz wants to merge 1 commit into
Open
feat(services): recover orphaned Android Keystore keys via on-chain m…#3182justjoolz wants to merge 1 commit into
justjoolz wants to merge 1 commit into
Conversation
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.
Feature: Recover Orphaned Android Keystore Keys via On-Chain Matching
Description
During key rotation, a new key can be written to the Android Keystore and added on-chain while the app fails to persist its local mapping (e.g. the process is interrupted before saving). The key then physically exists in the Keystore but the app has no record of it, so the account can't be used and doesn't appear in the switcher. This addresses the state reported in #2831.
This PR introduces a fail-safe recovery scanner that automatically detects these orphaned keys during app cold start, matches them against the user's on-chain Flow addresses, and writes them back into
KeyStorageManagerso they become usable again in the Account Switcher.The Fix
The new
KeyStoreMigrationManager.recoverOrphanedKeystoreKeys():KeyManager.KEYSTORE_ALIAS_PREFIX) physically present in the Android Keystore.UserPrefixandAccountmapping to the local cache, recovering the account without requiring the user to re-enter their seed phrase.Integration
To ensure compatibility with upcoming changes, this explicitly complements #2864 by populating the prefix map it reads from. Temporary synthetic accounts are injected to bridge the recovery state, which will integrate seamlessly with the new local account structures.
Verification
Account,UserInfoData,FlowWallet) cross-referenced against their definitions in currentdevand confirmed to supply all required parameters.