mirror of
https://github.com/wownero/wownero.git
synced 2026-10-27 19:38:41 +01:00
wallet: display private view keys for hardware wallets
This commit is contained in:
@@ -151,6 +151,7 @@ namespace hw {
|
|||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
virtual bool get_public_address(cryptonote::account_public_address &pubkey) = 0;
|
virtual bool get_public_address(cryptonote::account_public_address &pubkey) = 0;
|
||||||
virtual bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) = 0;
|
virtual bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) = 0;
|
||||||
|
virtual bool get_cached_view_key(crypto::secret_key &viewkey_out) { return false; }
|
||||||
virtual bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) = 0;
|
virtual bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) = 0;
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
|
|||||||
@@ -657,6 +657,15 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool device_ledger::get_cached_view_key(crypto::secret_key &viewkey_out) {
|
||||||
|
AUTO_LOCK_CMD();
|
||||||
|
|
||||||
|
if (!this->soft_request_view_key()) return false;
|
||||||
|
viewkey_out = this->viewkey;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool device_ledger::generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) {
|
bool device_ledger::generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) {
|
||||||
AUTO_LOCK_CMD();
|
AUTO_LOCK_CMD();
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ namespace hw {
|
|||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
bool get_public_address(cryptonote::account_public_address &pubkey) override;
|
bool get_public_address(cryptonote::account_public_address &pubkey) override;
|
||||||
bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override;
|
bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override;
|
||||||
|
bool get_cached_view_key(crypto::secret_key &viewkey_out) override;
|
||||||
bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) override;
|
bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) override;
|
||||||
void display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) override;
|
void display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) override;
|
||||||
|
|
||||||
|
|||||||
@@ -829,13 +829,16 @@ bool simple_wallet::viewkey(const std::vector<std::string> &args/* = std::vector
|
|||||||
{
|
{
|
||||||
// don't log
|
// don't log
|
||||||
PAUSE_READLINE();
|
PAUSE_READLINE();
|
||||||
if (m_wallet->key_on_device()) {
|
SCOPED_WALLET_UNLOCK();
|
||||||
std::cout << "secret: On device. Not available" << std::endl;
|
crypto::secret_key viewkey = m_wallet->get_account().get_keys().m_view_secret_key;
|
||||||
} else {
|
bool available = viewkey != crypto::null_skey;
|
||||||
SCOPED_WALLET_UNLOCK();
|
if (!available && m_wallet->key_on_device()) available = m_wallet->get_account().get_device().get_cached_view_key(viewkey);
|
||||||
|
if (available) {
|
||||||
printf("secret: ");
|
printf("secret: ");
|
||||||
print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key);
|
print_secret_key(viewkey);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
} else {
|
||||||
|
std::cout << "secret: On device. Not available" << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << "public: " << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key) << std::endl;
|
std::cout << "public: " << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key) << std::endl;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user