aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp6
-rw-r--r--src/wallet/api/wallet.h2
-rw-r--r--src/wallet/api/wallet2_api.h10
-rw-r--r--src/wallet/api/wallet_manager.cpp25
-rw-r--r--src/wallet/api/wallet_manager.h3
5 files changed, 33 insertions, 13 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 33047f703..4612b0397 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -725,7 +725,7 @@ 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)
+bool WalletImpl::recover(const std::string &path, const std::string &password, const std::string &seed, const std::string &seed_offset/* = {}*/)
{
clearStatus();
m_errorString.clear();
@@ -743,6 +743,10 @@ bool WalletImpl::recover(const std::string &path, const std::string &password, c
setStatusError(tr("Electrum-style word list failed verification"));
return false;
}
+ if (!seed_offset.empty())
+ {
+ recovery_key = cryptonote::decrypt_key(recovery_key, seed_offset);
+ }
if (old_language == crypto::ElectrumWords::old_language_name)
old_language = Language::English().get_language_name();
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index e46a62340..66eeb0e73 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -60,7 +60,7 @@ public:
const std::string &language) const override;
bool open(const std::string &path, const std::string &password);
bool recover(const std::string &path,const std::string &password,
- const std::string &seed);
+ const std::string &seed, const std::string &seed_offset = {});
bool recoverFromKeysWithPassword(const std::string &path,
const std::string &password,
const std::string &language,
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index 3945e55c9..6309724a4 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -1093,10 +1093,12 @@ struct WalletManager
* \param nettype Network type
* \param restoreHeight restore from start height
* \param kdf_rounds Number of rounds for key derivation function
+ * \param seed_offset Seed offset passphrase (optional)
* \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully)
*/
virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
- NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1) = 0;
+ NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1,
+ const std::string &seed_offset = {}) = 0;
Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
bool testnet = false, uint64_t restoreHeight = 0) // deprecated
{
@@ -1291,7 +1293,11 @@ struct WalletManager
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
//! checks for an update and returns version, hash and url
- static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, std::string subdir);
+ static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(
+ const std::string &software,
+ std::string subdir,
+ const char *buildtag = nullptr,
+ const char *current_version = nullptr);
};
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
index d589dcc75..8d7541cea 100644
--- a/src/wallet/api/wallet_manager.cpp
+++ b/src/wallet/api/wallet_manager.cpp
@@ -93,13 +93,14 @@ Wallet *WalletManagerImpl::recoveryWallet(const std::string &path,
const std::string &mnemonic,
NetworkType nettype,
uint64_t restoreHeight,
- uint64_t kdf_rounds)
+ uint64_t kdf_rounds,
+ const std::string &seed_offset/* = {}*/)
{
WalletImpl * wallet = new WalletImpl(nettype, kdf_rounds);
if(restoreHeight > 0){
wallet->setRefreshFromBlockHeight(restoreHeight);
}
- wallet->recover(path, password, mnemonic);
+ wallet->recover(path, password, mnemonic, seed_offset);
return wallet;
}
@@ -341,22 +342,30 @@ std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool
return addresses.front();
}
-std::tuple<bool, std::string, std::string, std::string, std::string> WalletManager::checkUpdates(const std::string &software, std::string subdir)
+std::tuple<bool, std::string, std::string, std::string, std::string> WalletManager::checkUpdates(
+ const std::string &software,
+ std::string subdir,
+ const char *buildtag/* = nullptr*/,
+ const char *current_version/* = nullptr*/)
{
+ if (buildtag == nullptr)
+ {
#ifdef BUILD_TAG
- static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
+ static const char buildtag_default[] = BOOST_PP_STRINGIZE(BUILD_TAG);
#else
- static const char buildtag[] = "source";
- // Override the subdir string when built from source
- subdir = "source";
+ static const char buildtag_default[] = "source";
+ // Override the subdir string when built from source
+ subdir = "source";
#endif
+ buildtag = buildtag_default;
+ }
std::string version, hash;
MDEBUG("Checking for a new " << software << " version for " << buildtag);
if (!tools::check_updates(software, buildtag, version, hash))
return std::make_tuple(false, "", "", "", "");
- if (tools::vercmp(version.c_str(), MONERO_VERSION) > 0)
+ if (tools::vercmp(version.c_str(), current_version != nullptr ? current_version : MONERO_VERSION) > 0)
{
std::string user_url = tools::get_update_url(software, subdir, buildtag, version, true);
std::string auto_url = tools::get_update_url(software, subdir, buildtag, version, false);
diff --git a/src/wallet/api/wallet_manager.h b/src/wallet/api/wallet_manager.h
index 537fc5ba6..0595b8327 100644
--- a/src/wallet/api/wallet_manager.h
+++ b/src/wallet/api/wallet_manager.h
@@ -46,7 +46,8 @@ public:
const std::string &mnemonic,
NetworkType nettype,
uint64_t restoreHeight,
- uint64_t kdf_rounds = 1) override;
+ uint64_t kdf_rounds = 1,
+ const std::string &seed_offset = {}) override;
virtual Wallet * createWalletFromKeys(const std::string &path,
const std::string &password,
const std::string &language,