Skip to content

Add deliberate confirmation for destructive wallet reset#280

Merged
El-swaggerito merged 2 commits into
Axionvera:mainfrom
simplicityf:feat/reset-phrase
Jul 23, 2026
Merged

Add deliberate confirmation for destructive wallet reset#280
El-swaggerito merged 2 commits into
Axionvera:mainfrom
simplicityf:feat/reset-phrase

Conversation

@simplicityf

@simplicityf simplicityf commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds deliberate, typed confirmation to the destructive wallet reset flow, so wallet data can no longer be cleared by a single accidental tap.

Related Issue

Closes #220

Screenrecord

Screen_Recording_20260723_120700_Expo.Go.mp4

Acceptance Criteria

Reset requires deliberate confirmation
Reset is gated behind WalletResetConfirmModal, reachable from Settings → "Sign Out & Clear Wallet" (and from the "Secure Storage Inaccessible" recovery screen). The destructive action is disabled until the user explicitly types a confirmation phrase.

Confirmation phrase is clear
The input is labeled Type "confirm reset" to confirm, with the exact phrase shown directly in the label and placeholder. Matching is trimmed/case-insensitive so minor typing variance (Confirm Reset, extra spaces) isn't punished, without weakening the requirement.

Reset cannot proceed until confirmation is valid
The confirm button (confirmDisabled={!isConfirmed} in ConfirmModal) stays disabled — greyed out and non-interactive, with accessibilityState={{ disabled }} — until the typed text matches. Verified in __tests__/WalletResetConfirmModal.test.tsx.

Destructive action is clearly labelled
Modal title "Reset Wallet", a warning banner, an itemized list of exactly what gets deleted (secret key, preferences, contacts, transaction history), a red "Delete Everything" button, and a disclaimer about backing up the secret key first. The entry point button in Settings is styled danger/red.

Flow remains accessible
Added accessibilityRole, accessibilityLabel, and accessibilityState (disabled/busy) to the modal's close/cancel/confirm buttons in ConfirmModal, which were previously unlabeled for screen readers. Also fixed the modal's layout so it scrolls instead of clipping content on smaller screens, with header and action buttons pinned so they're always reachable, and wrapped it in KeyboardAvoidingView so the keyboard doesn't obscure the input.

Bugs found and fixed while validating the flow end-to-end

  • Reset didn't sign the user out: clearing the wallet from Settings (which lives under the (tabs) route group) left the user stranded on wallet screens — a stale route-based guard in app/_layout.tsx was skipping the redirect-to-login whenever the current screen was under (tabs). Replaced it with a proper walletChecked load-state flag in walletStore, which also fixes the cold-start race the old guard was papering over.
  • App wouldn't bundle/run at all, blocking manual testing: a stale metro.config.js override pointed @stellar/stellar-sdk at a deleted nested path; once fixed, a second issue surfaced — the SDK's browser bundle uses private class-field syntax Hermes can't parse, so the resolver now points at the SDK's Node build instead.
  • "Runtime not ready" crash on device: expo-camera, expo-clipboard, expo-local-authentication, react, babel-preset-expo, and jest-expo were installed at versions incompatible with the project's Expo SDK (54); realigned via expo install --fix.

Test plan

  • npx jest __tests__/WalletResetConfirmModal.test.tsx — confirm button disabled on empty/wrong input, enabled on exact (case/whitespace-insensitive) phrase match, cancel works without the phrase
  • npx jest __tests__/walletStore.test.ts __tests__/walletStore.pagination.test.ts — 24/24 passing
  • npx jest __tests__/ErrorBoundary.test.tsx — passing
  • Manual, on-device: reset wallet from Settings → correctly redirected to login/import screen, wallet data cleared
  • Manual, on-device: modal fully visible and scrollable on a small screen, no cut-off buttons

…al accessible and scrollable, and resolve the Metro/Expo dependency issues blocking the app from running.
@El-swaggerito

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because it has merge conflicts.

Please update the branch with the latest base branch and resolve the conflicts.

After the conflicts are resolved and checks pass, the automation can review it again.

@El-swaggerito
El-swaggerito merged commit f83c1b6 into Axionvera:main Jul 23, 2026
1 check 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.

Add mobile wallet reset confirmation phrase

2 participants