aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet.cpp
diff options
context:
space:
mode:
authorm2049r <30435443+m2049r@users.noreply.github.com>2018-01-11 16:12:27 +0100
committerm2049r <30435443+m2049r@users.noreply.github.com>2018-01-17 18:46:31 +0100
commit939629e837d744118acd1191bd08f8627c704402 (patch)
tree4c70094a7e8cf407383c5963fbfd801a25a434f9 /src/wallet/api/wallet.cpp
parentMerge pull request #3091 (diff)
downloadmonero-939629e837d744118acd1191bd08f8627c704402.tar.xz
Wallet API: all recover options with password
also renamed memo => mnemonic in api method parms
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r--src/wallet/api/wallet.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index fd0b65866..753ce259e 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -458,6 +458,16 @@ bool WalletImpl::recoverFromKeys(const std::string &path,
const std::string &viewkey_string,
const std::string &spendkey_string)
{
+ return recoverFromKeysWithPassword(path, "", language, address_string, viewkey_string, spendkey_string);
+}
+
+bool WalletImpl::recoverFromKeysWithPassword(const std::string &path,
+ const std::string &password,
+ const std::string &language,
+ const std::string &address_string,
+ const std::string &viewkey_string,
+ const std::string &spendkey_string)
+{
cryptonote::address_parse_info info;
if(!get_account_address_from_str(info, m_wallet->testnet(), address_string))
{
@@ -524,12 +534,12 @@ bool WalletImpl::recoverFromKeys(const std::string &path,
try
{
if (has_spendkey) {
- m_wallet->generate(path, "", info.address, spendkey, viewkey);
+ m_wallet->generate(path, password, info.address, spendkey, viewkey);
setSeedLanguage(language);
LOG_PRINT_L1("Generated new wallet from keys with seed language: " + language);
}
else {
- m_wallet->generate(path, "", info.address, viewkey);
+ m_wallet->generate(path, password, info.address, viewkey);
LOG_PRINT_L1("Generated new view only wallet from keys");
}
@@ -570,6 +580,11 @@ bool WalletImpl::open(const std::string &path, const std::string &password)
bool WalletImpl::recover(const std::string &path, const std::string &seed)
{
+ return recover(path, "", seed);
+}
+
+bool WalletImpl::recover(const std::string &path, const std::string &password, const std::string &seed)
+{
clearStatus();
m_errorString.clear();
if (seed.empty()) {
@@ -590,7 +605,7 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed)
try {
m_wallet->set_seed_language(old_language);
- m_wallet->generate(path, "", recovery_key, true, false);
+ m_wallet->generate(path, password, recovery_key, true, false);
} catch (const std::exception &e) {
m_status = Status_Critical;