Files
self/packages/webview-app/tests/utils
Justin Hernandez 5268ccb767 Fix recovery rollback handling (#1905)
* Fix recovery rollback handling

* Restore registration state on rollback

* Restore selected document on rollback

* fix(webview): clear both keys on partial rollback to prevent mnemonic/secret mismatch

When restoreSnapshotBestEffort partially fails (e.g. mnemonic rollback fails but secret rollback succeeds), the stored mnemonic and private key can end up mismatched — deriving from the stored mnemonic produces a different key than what's stored. This is silent data corruption that could lock users out of recovery.

Fix: when any rollback write fails, clear both keys so ensureSecret can regenerate a consistent pair from scratch. A missing pair is recoverable; a mismatched pair is not.

Adds a test in restoreSecretFromMnemonic that proves the mismatch scenario and verifies both keys are cleared.

* feat(new-common): add humanizeContractError utility with tests

* fix: prettier formatting in secretManager test

---------

Co-authored-by: Tranquil-Flow <tranquil_flow@protonmail.com>
2026-04-04 10:27:21 +10:00
..