diff options
author | Riccardo Spagni <ric@spagni.net> | 2014-08-05 09:43:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-08-05 09:43:39 +0200 |
commit | 43c013a57f3bd5e0c70695c93ca6a76b78043288 (patch) | |
tree | 0a859060427ffd9881385d7e27eff0547507ffb0 /src/wallet/wallet2.cpp | |
parent | Merge pull request #81 from tewinget/restore-fix (diff) | |
parent | added view_key to wallet RPC command query_key (diff) | |
download | monero-43c013a57f3bd5e0c70695c93ca6a76b78043288.tar.xz |
Merge pull request #86 from jakoblind/seed
Query view key and seed
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 86f2dc0d5..da45771af 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -45,7 +45,13 @@ using namespace epee; #include "crypto/crypto.h" #include "serialization/binary_utils.h" #include "cryptonote_protocol/blobdatatype.h" +#include "crypto/electrum-words.h" +extern "C" +{ +#include "crypto/keccak.h" +#include "crypto/crypto-ops.h" +} using namespace cryptonote; namespace @@ -78,6 +84,18 @@ void wallet2::init(const std::string& daemon_address, uint64_t upper_transaction m_daemon_address = daemon_address; } //---------------------------------------------------------------------------------------------------- +bool wallet2::get_seed(std::string& electrum_words) +{ + crypto::ElectrumWords::bytes_to_words(get_account().get_keys().m_spend_secret_key, electrum_words); + + crypto::secret_key second; + keccak((uint8_t *)&get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key)); + + sc_reduce32((uint8_t *)&second); + + return memcmp(second.data,get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key)) == 0; +} +//---------------------------------------------------------------------------------------------------- void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_t height) { process_unconfirmed(tx); |