Skip to content

fix keychain reset not resetting wallet state #6740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025
Merged

Conversation

natew
Copy link
Contributor

@natew natew commented Jul 8, 2025

Fixes bug with duplicated wallets after resetting keychain.

Testing flow:

  1. Import wallets using seed or backup
  2. Hit "Reset Keychain" and confirm
  3. Import same seed or backup again
  4. Make sure they look right - no duplicate wallets.

@jinchung
Copy link
Member

jinchung commented Jul 8, 2025

Launch in simulator or device for abef453

@@ -188,6 +188,7 @@ const DevSection = () => {
if (shouldWipeKeychain) {
await wipeKeychain();
await clearMMKVStorage();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good to follow up with this, but I think some of the MMKV instances being reset in clearMMKVStorage aren't necessary to reset when the intention is only to reset wallets/the keychain. May not be needed at all, or at least likely only specific STORAGE_IDS need clearing, e.g. FIRST_APP_LAUNCH:

export const STORAGE_IDS = {
ACCOUNT: 'ACCOUNT',
ASPECT_RATIO: 'ASPECT_RATIO',
DOMINANT_COLOR: 'DOMINANT_COLOR',
EXPERIMENTAL_CONFIG: 'EXPERIMENTAL_CONFIG',
FIRST_APP_LAUNCH: 'FIRST_APP_LAUNCH',
SWAPS_METADATA_STORAGE: 'SWAP_METADATA_STORAGE',
LOCAL_STORAGE_ADAPTER: 'LOCAL_STORAGE_ADAPTER',
NOTIFICATIONS: 'NOTIFICATIONS',
RAINBOW_TOKEN_LIST: 'LEAN_RAINBOW_TOKEN_LIST',
SHOWN_SWAP_RESET_WARNING: 'SHOWN_SWAP_RESET_WARNING',
PROMO_CURRENTLY_SHOWN: 'PROMO_CURRENTLY_SHOWN',
LAST_PROMO_SHEET_TIMESTAMP: 'LAST_PROMO_SHEET_TIMESTAMP',
UNLOCKABLE_APP_ICONS: 'UNLOCKABLE_APP_ICONS',
};

Also, assuming wipeKeychain is important to resetting wallets state fully, would be good to move that into clearWalletState (in the resetKeychain path) so that clearWalletState can cleanly be used on its own to fully reset, along with handling any necessary MMKV storage resetting.

@natew natew merged commit bdc0fcb into develop Jul 8, 2025
7 of 9 checks passed
@natew natew deleted the fix-reset-keychain branch July 8, 2025 20:03
Copy link
Contributor

@ibrahimtaveras00 ibrahimtaveras00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good on both OS's, QA Passed ✅

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.

4 participants