Skip to content

Commit

Permalink
get public spend and view keys from wallet rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jun 11, 2024
1 parent b3c9547 commit 5822ae1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/wallet/wallet_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,21 @@ namespace tools
epee::wipeable_string key = epee::to_hex::wipeable_string(m_wallet->get_account().get_keys().m_spend_secret_key);
res.key = std::string(key.data(), key.size());
}
else if(req.key_type.compare("public_view_key") == 0)
{
epee::wipeable_string key = epee::to_hex::wipeable_string(m_wallet->get_account().get_keys().m_account_address.m_view_public_key);
res.key = std::string(key.data(), key.size());
}
else if(req.key_type.compare("public_spend_key") == 0) {
if (m_wallet->watch_only())
{
er.code = WALLET_RPC_ERROR_CODE_WATCH_ONLY;
er.message = "The wallet is watch-only. Cannot retrieve public spend key.";
return false;
}
epee::wipeable_string key = epee::to_hex::wipeable_string(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key);
res.key = std::string(key.data(), key.size());
}
else
{
er.message = "key_type " + req.key_type + " not found";
Expand Down

0 comments on commit 5822ae1

Please sign in to comment.