Files
ObsidianDragon/src/ui/windows/key_export_dialog.h
T
DanSandClaude Opus 4.8 1a41dec8d8 test(sweep): add capture surfaces for the Wave-2 fund/secret modals
Register sweep surfaces for the redesigned Wave-2 modals so they get captured for
visual review: modal-shield + modal-merge (ShieldDialog's two modes),
modal-transfer (a z->t transfer so the converted deshielding DialogWarningHeader
renders), and modal-key-export (KeyExportDialog — named distinctly from the
settings modal-export-key). Each setup opens the dialog through its public show()
without clicking any button, so no async RPC fires; teardown closes it.

Adds a static hide() to ShieldDialog and KeyExportDialog for clean sweep teardown
(AddressTransferDialog already had close()). KeyExportDialog::hide() also clears the
revealed key + frees its QR, mirroring the dialog's own close/dismiss secret-wipe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 18:37:22 -05:00

69 lines
1.6 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include <cstdint>
#include <string>
namespace dragonx {
class App;
namespace ui {
/**
* @brief Dialog for exporting private/viewing keys
*
* Displays the private or viewing key for a given address with
* security warnings and copy functionality.
*/
class KeyExportDialog {
public:
enum class KeyType {
Private,
Viewing
};
/**
* @brief Show the key export dialog for an address
* @param address The address to export key for
* @param type The type of key to export
*/
static void show(const std::string& address, KeyType type);
/**
* @brief Render the dialog (call every frame)
* @param app Pointer to app instance for RPC calls
*/
static void render(App* app);
/**
* @brief Check if dialog is currently open
*/
static bool isOpen();
/**
* @brief Close the dialog and clear the revealed key (used by the UI sweep teardown)
*/
static void hide();
private:
static bool s_open;
static bool s_fetching;
static bool s_show_key;
static bool s_show_qr; // inline QR of the revealed key (for scanning into another wallet)
static std::uintptr_t s_qr_tex; // cached QR texture handle (0 = none)
static std::string s_qr_cached; // key the cached QR was generated for
static KeyType s_key_type;
static std::string s_address;
static std::string s_key;
static std::string s_error;
static void releaseQr(); // free the QR texture + reset its state
};
} // namespace ui
} // namespace dragonx