Skip to content

Feature/wallet reset confirmation#276

Merged
El-swaggerito merged 2 commits into
Axionvera:mainfrom
onyekachi66:feature/wallet-reset-confirmation
Jul 23, 2026
Merged

Feature/wallet reset confirmation#276
El-swaggerito merged 2 commits into
Axionvera:mainfrom
onyekachi66:feature/wallet-reset-confirmation

Conversation

@onyekachi66

Copy link
Copy Markdown
Contributor

Closes #174

Summary

This Pull Request improves user experience and guards against accidental wallet deletion by requiring a deliberate confirmation phrase ("confirm reset") for all destructive wallet reset flows. Previously, the settings reset required typing a single word (RESET), and the critical secure storage inaccessible error fallback reset could be executed with a simple alert box confirmation click. Both entry points have now been unified under a secure, case-insensitive, and accessible text-entry confirmation modal.


Rationale & Impact

Accidentally resetting wallet data deletes the user's secure keystore database on-device, including Stellar secret keys, transaction history, app settings, and cached contact lists. If a user does not have their recovery phrase or secret key written down offline, this action is irreversible and leads to total loss of funds access.

By upgrading the validation phrase to a multi-word lowercase phrase ("confirm reset") and applying it to both settings and startup recovery/error screens, we guarantee that the user is making a conscious, deliberate choice before execution.


Detailed Changes

1. Unified Confirmation Behavior

  • File: src/components/WalletResetConfirmModal.tsx
    • Updated the target phrase CONFIRMATION_TEXT from 'RESET' to 'confirm reset'.
    • Upgraded validation logic from an exact string match to a case-insensitive, trimmed match:
      const isConfirmed = typedText.trim().toLowerCase() === CONFIRMATION_TEXT;
    • Configured input fields with autoCapitalize="none" to make entering the lowercase phrase painless on mobile keyboard overlays.
    • Refactored placeholders and screen reader accessibility labels to reflect the updated phrase correctly.

2. Error Fallback Screen Integration

  • File: app/_layout.tsx
    • Integrated React state hooks to manage the visibility and execution states of the wallet reset confirmation modal directly from the root layout.
    • Replaced the simple Alert.alert confirm button inside handleReset with the WalletResetConfirmModal.
    • Mounted the modal within the JSX return block of the "Failed to restore wallet securely" error view, protecting users from wiping their database accidentally during startup troubleshooting.

Verification & Testing Plan

Automated Verification

  • Ran existing Jest/Expo test suites to ensure that general state transitions and wallet storage cleaners continue functioning correctly without side effects.
  • Ran TypeScript checks via tsc --noEmit to verify type safety on the updated layout files and modals.

Manual Test Checklist

  1. Settings Reset:
    • Go to App Settings -> Tap "Sign Out & Clear Wallet".
    • Verify that the modal demands the user type "confirm reset".
    • Verify that typing "CONFIRM RESET", "confirm reset ", or "Confirm Reset" activates the "Delete Everything" action (verifying case-insensitivity and trim checks).
    • Verify that incorrect strings or single words do not enable the delete action.
  2. Startup Error Reset:
    • Force a storage failure to trigger the Failed to restore wallet securely fallback.
    • Tap "Reset & Import Again".
    • Confirm that the interactive modal appears instead of a simple OS Alert box, requiring the same deliberate "confirm reset" input validation before deleting data.

@El-swaggerito
El-swaggerito merged commit 4cfde60 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