diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-11-09 14:10:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-11-09 14:10:39 +0200 |
commit | 56c594a8feb85620492b4aafa469dd2823b9afa6 (patch) | |
tree | fec8eab59542a2b5814aac1cdb1cf804389a4af0 /src/wallet/api/wallet.cpp | |
parent | Merge pull request #1307 (diff) | |
parent | wallet2_api: API to sign and verify a message (diff) | |
download | monero-56c594a8feb85620492b4aafa469dd2823b9afa6.tar.xz |
Merge pull request #1309
c441a61 wallet2_api: API to sign and verify a message (moneromooo-monero)
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 3768a7998..4af7ac6f8 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -752,6 +752,23 @@ std::string WalletImpl::getTxKey(const std::string &txid) const } } +std::string WalletImpl::signMessage(const std::string &message) +{ + return m_wallet->sign(message); +} + +bool WalletImpl::verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const +{ + cryptonote::account_public_address addr; + bool has_payment_id; + crypto::hash8 payment_id; + + if (!cryptonote::get_account_integrated_address_from_str(addr, has_payment_id, payment_id, m_wallet->testnet(), address)) + return false; + + return m_wallet->verify(message, addr, signature); +} + bool WalletImpl::connectToDaemon() { bool result = m_wallet->check_connection(); |