aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet_manager.cpp
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-07-06 15:42:08 +0900
committerstoffu <stoffu@protonmail.ch>2018-08-08 01:56:54 +0900
commitbcab579864801e765333e8766b714adc22e47b8b (patch)
treecbf9e199af327a703804b403a3a9b08da18e778a /src/wallet/api/wallet_manager.cpp
parentMerge pull request #4129 (diff)
downloadmonero-bcab579864801e765333e8766b714adc22e47b8b.tar.xz
wallet: allow adjusting number of rounds for the key derivation function
Diffstat (limited to 'src/wallet/api/wallet_manager.cpp')
-rw-r--r--src/wallet/api/wallet_manager.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
index 99eadc82f..5daf11ec0 100644
--- a/src/wallet/api/wallet_manager.cpp
+++ b/src/wallet/api/wallet_manager.cpp
@@ -50,16 +50,16 @@ namespace epee {
namespace Monero {
Wallet *WalletManagerImpl::createWallet(const std::string &path, const std::string &password,
- const std::string &language, NetworkType nettype)
+ const std::string &language, NetworkType nettype, uint64_t kdf_rounds)
{
- WalletImpl * wallet = new WalletImpl(nettype);
+ WalletImpl * wallet = new WalletImpl(nettype, false, kdf_rounds);
wallet->create(path, password, language);
return wallet;
}
-Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string &password, NetworkType nettype)
+Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds)
{
- WalletImpl * wallet = new WalletImpl(nettype);
+ WalletImpl * wallet = new WalletImpl(nettype, false, kdf_rounds);
wallet->open(path, password);
//Refresh addressBook
wallet->addressBook()->refresh();
@@ -87,9 +87,10 @@ Wallet *WalletManagerImpl::recoveryWallet(const std::string &path,
const std::string &password,
const std::string &mnemonic,
NetworkType nettype,
- uint64_t restoreHeight)
+ uint64_t restoreHeight,
+ uint64_t kdf_rounds)
{
- WalletImpl * wallet = new WalletImpl(nettype);
+ WalletImpl * wallet = new WalletImpl(nettype, false, kdf_rounds);
if(restoreHeight > 0){
wallet->setRefreshFromBlockHeight(restoreHeight);
}
@@ -104,9 +105,10 @@ Wallet *WalletManagerImpl::createWalletFromKeys(const std::string &path,
uint64_t restoreHeight,
const std::string &addressString,
const std::string &viewKeyString,
- const std::string &spendKeyString)
+ const std::string &spendKeyString,
+ uint64_t kdf_rounds)
{
- WalletImpl * wallet = new WalletImpl(nettype);
+ WalletImpl * wallet = new WalletImpl(nettype, false, kdf_rounds);
if(restoreHeight > 0){
wallet->setRefreshFromBlockHeight(restoreHeight);
}
@@ -119,9 +121,10 @@ Wallet *WalletManagerImpl::createWalletFromDevice(const std::string &path,
NetworkType nettype,
const std::string &deviceName,
uint64_t restoreHeight,
- const std::string &subaddressLookahead)
+ const std::string &subaddressLookahead,
+ uint64_t kdf_rounds)
{
- WalletImpl * wallet = new WalletImpl(nettype);
+ WalletImpl * wallet = new WalletImpl(nettype, false, kdf_rounds);
if(restoreHeight > 0){
wallet->setRefreshFromBlockHeight(restoreHeight);
}
@@ -159,9 +162,9 @@ bool WalletManagerImpl::walletExists(const std::string &path)
return false;
}
-bool WalletManagerImpl::verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const
+bool WalletManagerImpl::verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds) const
{
- return tools::wallet2::verify_password(keys_file_name, password, no_spend_key, hw::get_device("default"));
+ return tools::wallet2::verify_password(keys_file_name, password, no_spend_key, hw::get_device("default"), kdf_rounds);
}
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)