Wallet API: add spend/view key getters

This commit is contained in:
Jaquee 2017-05-02 16:48:38 +02:00
parent c9063c0b8f
commit bbf4c21048
3 changed files with 41 additions and 5 deletions

View File

@ -618,11 +618,26 @@ std::string WalletImpl::integratedAddress(const std::string &payment_id) const
return m_wallet->get_account().get_public_integrated_address_str(pid, m_wallet->testnet()); return m_wallet->get_account().get_public_integrated_address_str(pid, m_wallet->testnet());
} }
std::string WalletImpl::privateViewKey() const std::string WalletImpl::secretViewKey() const
{ {
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key); return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key);
} }
std::string WalletImpl::publicViewKey() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key);
}
std::string WalletImpl::secretSpendKey() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_spend_secret_key);
}
std::string WalletImpl::publicSpendKey() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key);
}
std::string WalletImpl::path() const std::string WalletImpl::path() const
{ {
return m_wallet->path(); return m_wallet->path();

View File

@ -73,7 +73,10 @@ public:
bool setPassword(const std::string &password); bool setPassword(const std::string &password);
std::string address() const; std::string address() const;
std::string integratedAddress(const std::string &payment_id) const; std::string integratedAddress(const std::string &payment_id) const;
std::string privateViewKey() const; std::string secretViewKey() const;
std::string publicViewKey() const;
std::string secretSpendKey() const;
std::string publicSpendKey() const;
std::string path() const; std::string path() const;
bool store(const std::string &path); bool store(const std::string &path);
std::string filename() const; std::string filename() const;

View File

@ -312,10 +312,28 @@ struct Wallet
virtual std::string integratedAddress(const std::string &payment_id) const = 0; virtual std::string integratedAddress(const std::string &payment_id) const = 0;
/*! /*!
* \brief privateViewKey - returns private view key * \brief secretViewKey - returns secret view key
* \return - private view key * \return - secret view key
*/ */
virtual std::string privateViewKey() const = 0; virtual std::string secretViewKey() const = 0;
/*!
* \brief publicViewKey - returns public view key
* \return - public view key
*/
virtual std::string publicViewKey() const = 0;
/*!
* \brief secretSpendKey - returns secret spend key
* \return - secret spend key
*/
virtual std::string secretSpendKey() const = 0;
/*!
* \brief publicSpendKey - returns public spend key
* \return - public spend key
*/
virtual std::string publicSpendKey() const = 0;
/*! /*!
* \brief store - stores wallet to file. * \brief store - stores wallet to file.