fix(security): color seed-save by outcome; explain the Encrypt button; friendly key-export errors

- Seed-backup dialog: a failed "Save to file" was drawn in the success (green)
  colour; it's now red on failure, green on success (flag reset on close).
- Encrypt-wallet dialog: the disabled Encrypt button now says why once the user
  starts typing ("Use at least 8 characters." / "The passphrases don't match."),
  and a "Show passphrase" checkbox reveals both fields.
- Key-export dialog: the raw RPC exception (e.g. "...walletpassphrase first")
  is routed through util::friendlyRpcError(), so a locked wallet reads
  "Unlock your wallet first, then try again." instead of daemon jargon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 09:09:29 -05:00
co-authored by Claude Opus 4.8
parent 7d2972f315
commit 4c6a78b3b0
5 changed files with 25 additions and 9 deletions
+5 -1
View File
@@ -4635,6 +4635,7 @@ void App::renderSeedBackupDialog()
sodium_memzero(&seed_backup_phrase_[0], seed_backup_phrase_.size());
seed_backup_phrase_.clear();
seed_backup_status_.clear();
seed_backup_status_ok_ = true;
seed_backup_fetch_started_ = false;
seed_backup_loading_ = false;
seed_backup_no_mnemonic_ = false;
@@ -4707,7 +4708,9 @@ void App::renderSeedBackupDialog()
ImGui::Spacing();
if (!seed_backup_status_.empty()) {
ImGui::PushTextWrapPos(0.0f);
ImGui::TextColored(ui::material::SuccessVec4(), "%s", seed_backup_status_.c_str());
ImGui::TextColored(seed_backup_status_ok_ ? ui::material::SuccessVec4()
: ImVec4(0.85f, 0.33f, 0.33f, 1.0f),
"%s", seed_backup_status_.c_str());
ImGui::PopTextWrapPos();
ImGui::Spacing();
}
@@ -4724,6 +4727,7 @@ void App::renderSeedBackupDialog()
const bool ok = util::Platform::writeFileAtomically(path, content,
/*restrictPermissions=*/true);
sodium_memzero(&content[0], content.size());
seed_backup_status_ok_ = ok; // red when the write failed (was always green before)
seed_backup_status_ = (ok ? std::string(TR("seed_backup_saved"))
: std::string(TR("seed_backup_save_failed"))) + path;
}