From fcbf89ff238486654f62e85a63daf78835acc3d6 Mon Sep 17 00:00:00 2001
From: sneak
Date: Tue, 27 Oct 2026 01:01:45 +0000
Subject: [PATCH] fix: the StateRecovery erase warning names every kind of
wallet backup (closes #593)
The erase warning told every user to rely on each wallet's recovery
phrase. A wallet imported from a private key or an extended private key
has no recovery phrase. The warning now names all three, in the words the
delete wallet screens use. The screen cannot read the wallets, so one
sentence covers every kind. README's StateRecovery entry says the same.
Model: opus-5-5
---
README.md | 3 +++
src/popup/index.html | 9 +++++----
tests/stateRecovery.test.js | 26 ++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index d5a5221..85cb8d7 100644
--- a/README.md
+++ b/README.md
@@ -2820,6 +2820,9 @@ view would leave a wallet one click from deletion.
- "Export Saved Data" button, and the read-only text box it fills
- What erasing does and does not do, in bold: every wallet stored in this
browser is deleted; nothing on chain changes and no money is moved
+ - What a wallet can be added again from: a kept copy of its recovery phrase,
+ private key or extended private key. Without that copy or the exported
+ copy, everything the wallet holds is gone forever.
- A text input asking for `ERASE MY WALLET` to be typed back
- Error line
- "Erase Saved Data" button
diff --git a/src/popup/index.html b/src/popup/index.html
index 81e3eb2..2ccd7d0 100644
--- a/src/popup/index.html
+++ b/src/popup/index.html
@@ -1994,10 +1994,11 @@
>Erasing the saved data deletes every wallet stored in
this browser.
- Nothing on the blockchain changes and no money is moved, but
- without the exported copy above, or the recovery phrase for
- each wallet written down, everything they hold is gone
- forever.
+ Nothing on the blockchain changes and no money is moved. If
+ you kept a copy of a wallet's recovery phrase, private key
+ or extended private key, you can add that wallet again.
+ Without that copy or the exported copy above, everything the
+ wallet holds is gone forever.
To confirm, type
diff --git a/tests/stateRecovery.test.js b/tests/stateRecovery.test.js
index 8fd2064..d4f605e 100644
--- a/tests/stateRecovery.test.js
+++ b/tests/stateRecovery.test.js
@@ -23,6 +23,9 @@
// version field, and showing those users a wipe prompt would be a worse defect
// than the one being fixed. It is migrated in place and keeps working.
+const fs = require("fs");
+const path = require("path");
+
const {
bootPopup,
cleanupPopup,
@@ -148,6 +151,29 @@ describe("the destructive reset on the recovery screen", () => {
});
});
+// A key or xprv wallet has no recovery phrase, so the erase warning names all
+// three backups (https://git.eeqj.de/sneak/AutistMask/issues/593). The boot
+// harness holds no static text, so this reads the markup itself.
+describe("the erase warning on the recovery screen", () => {
+ test("names the recovery phrase, the private key and the extended private key", () => {
+ const html = fs.readFileSync(
+ path.join(__dirname, "..", "src", "popup", "index.html"),
+ "utf8",
+ );
+ const start = html.indexOf('id="view-state-recovery"');
+ const end = html.indexOf('id="btn-state-recovery-reset"', start);
+ const screenText = html
+ .slice(start, end)
+ .replace(/<[^>]*>/g, " ")
+ .replace(/\s+/g, " ");
+
+ expect(screenText).toContain(
+ "If you kept a copy of a wallet's recovery phrase, private key or " +
+ "extended private key, you can add that wallet again.",
+ );
+ });
+});
+
describe("a popup already open when the stored profile becomes unreadable", () => {
// https://git.eeqj.de/sneak/AutistMask/issues/373. The popup used to stay
// on the wallet list with the last good balances, and only a reopen
--
2.54.0