Skip to content

fix(wallet): recovery phrase shows the active wallet; discoverable rename/remove on Wallets - #794

Merged
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
claude/wallets-rename-delete-recovery
Jul 9, 2026
Merged

QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
claude/wallets-rename-delete-recovery

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Recovery phrase bug (the dangerous one)

Settings → View Recovery Phrase read the mnemonic of whatever wallet WalletStorage.listWalletIdsWithMnemonic() happened to enumerate first (DWPreviewSeedPhraseModel+Mnemonic.swift). With more than one wallet on device, it could show a different wallet's recovery phrase — a user diligently backing up those words would be backing up the wrong wallet.

Fix: resolve the active wallet through the per-network registry (WalletEnvironment.activeWalletId(for:), which is seeded on wallet create, host start, and runtime switch), with a fallback to the sole stored wallet for pre-registry installs. If several wallets exist and none matches the registry, the reader returns nil (empty screen) — deliberately safer than guessing, since showing a plausible-but-wrong phrase is the worst outcome. The verify-seed onboarding flow was unaffected (it checks the in-hand phrase, not storage).

Wallets: visible rename and remove

Rename and per-wallet Remove were already implemented on the Wallets screen — but only reachable via long-press context menu, so in practice invisible. Each wallet row now has a visible ⋯ menu with:

  • Rename — existing alert flow; stores the name in PersistentWallet.name, empty resets to the default "Wallet abcd1234…" label.
  • Remove — existing safety flow: warning copy, requires typing that wallet's own recovery phrase (verified by deriving its walletId), destructive confirm; the last remaining wallet still routes to the full reset flow. If the removed wallet is active, the app switches to another wallet first.

The long-press context menu is kept as a secondary path.

Verification

  • Clean dashpay scheme build (iphonesimulator, ARCHS=arm64).
  • On-device check on the QA simulator pending (wallet is PIN-locked in this environment). Suggested manual test: with 2+ wallets, switch to the second wallet and open View Recovery Phrase — before this fix it could show wallet DashSync migration part 1 #1's words; after, it must show the active wallet's.

🤖 Generated with Claude Code

…remove on Wallets rows

View Recovery Phrase read the FIRST wallet WalletStorage enumerated, so
with several wallets on device it could display another wallet's phrase
— a dangerous backup. It now resolves the active wallet through the
per-network registry (WalletEnvironment.activeWalletId, seeded on
create/start/switch), falls back to the sole stored wallet on
pre-registry installs, and shows nothing rather than the wrong phrase
when the active wallet can't be resolved among several.

The Wallets screen's rename and remove actions existed only in the
long-press context menu, which is undiscoverable; each row now has a
visible ellipsis menu offering both (the context menu remains).

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6750c434-9af0-4f13-9e30-6b9eafba140e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/wallets-rename-delete-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@QuantumExplorer
QuantumExplorer merged commit 0f457b0 into swift-sdk-integration Jul 9, 2026
1 check passed
llbartekll added a commit that referenced this pull request Jul 10, 2026
…irst

switchToNetwork's registry mirror picked persistedMnemonics().first —
the same wrong-wallet class #794 fixed for the recovery phrase. With
several on-device wallets it could register another wallet's DSWallet on
the destination chain. Resolve through the per-network active-wallet
registry (destination's entry, then the current network's, then the sole
stored wallet on pre-registry installs); with several wallets and no
registry match, mirror nothing rather than the wrong wallet.

Co-Authored-By: Claude Fable 5 <[email protected]>
@QuantumExplorer
QuantumExplorer deleted the claude/wallets-rename-delete-recovery branch August 7, 2026 08:22
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.

1 participant