forked from Public/monero-gui
Allow adjusting number of rounds for the key derivation function
This commit is contained in:
@@ -25,7 +25,7 @@ WalletManager *WalletManager::instance()
|
||||
}
|
||||
|
||||
Wallet *WalletManager::createWallet(const QString &path, const QString &password,
|
||||
const QString &language, NetworkType::Type nettype)
|
||||
const QString &language, NetworkType::Type nettype, quint64 kdfRounds)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_currentWallet) {
|
||||
@@ -33,12 +33,12 @@ Wallet *WalletManager::createWallet(const QString &path, const QString &password
|
||||
delete m_currentWallet;
|
||||
}
|
||||
Monero::Wallet * w = m_pimpl->createWallet(path.toStdString(), password.toStdString(),
|
||||
language.toStdString(), static_cast<Monero::NetworkType>(nettype));
|
||||
language.toStdString(), static_cast<Monero::NetworkType>(nettype), kdfRounds);
|
||||
m_currentWallet = new Wallet(w);
|
||||
return m_currentWallet;
|
||||
}
|
||||
|
||||
Wallet *WalletManager::openWallet(const QString &path, const QString &password, NetworkType::Type nettype)
|
||||
Wallet *WalletManager::openWallet(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_currentWallet) {
|
||||
@@ -48,7 +48,7 @@ Wallet *WalletManager::openWallet(const QString &path, const QString &password,
|
||||
qDebug("%s: opening wallet at %s, nettype = %d ",
|
||||
__PRETTY_FUNCTION__, qPrintable(path), nettype);
|
||||
|
||||
Monero::Wallet * w = m_pimpl->openWallet(path.toStdString(), password.toStdString(), static_cast<Monero::NetworkType>(nettype));
|
||||
Monero::Wallet * w = m_pimpl->openWallet(path.toStdString(), password.toStdString(), static_cast<Monero::NetworkType>(nettype), kdfRounds);
|
||||
qDebug("%s: opened wallet: %s, status: %d", __PRETTY_FUNCTION__, w->address(0, 0).c_str(), w->status());
|
||||
m_currentWallet = new Wallet(w);
|
||||
|
||||
@@ -60,10 +60,10 @@ Wallet *WalletManager::openWallet(const QString &path, const QString &password,
|
||||
return m_currentWallet;
|
||||
}
|
||||
|
||||
void WalletManager::openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype)
|
||||
void WalletManager::openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype, quint64 kdfRounds)
|
||||
{
|
||||
QFuture<Wallet*> future = QtConcurrent::run(this, &WalletManager::openWallet,
|
||||
path, password, nettype);
|
||||
path, password, nettype, kdfRounds);
|
||||
QFutureWatcher<Wallet*> * watcher = new QFutureWatcher<Wallet*>();
|
||||
|
||||
connect(watcher, &QFutureWatcher<Wallet*>::finished,
|
||||
@@ -76,21 +76,21 @@ void WalletManager::openWalletAsync(const QString &path, const QString &password
|
||||
}
|
||||
|
||||
|
||||
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo, NetworkType::Type nettype, quint64 restoreHeight)
|
||||
Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo, NetworkType::Type nettype, quint64 restoreHeight, quint64 kdfRounds)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_currentWallet) {
|
||||
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||
delete m_currentWallet;
|
||||
}
|
||||
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), memo.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight);
|
||||
Monero::Wallet * w = m_pimpl->recoveryWallet(path.toStdString(), "", memo.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight, kdfRounds);
|
||||
m_currentWallet = new Wallet(w);
|
||||
return m_currentWallet;
|
||||
}
|
||||
|
||||
Wallet *WalletManager::createWalletFromKeys(const QString &path, const QString &language, NetworkType::Type nettype,
|
||||
const QString &address, const QString &viewkey, const QString &spendkey,
|
||||
quint64 restoreHeight)
|
||||
quint64 restoreHeight, quint64 kdfRounds)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_currentWallet) {
|
||||
@@ -98,8 +98,8 @@ Wallet *WalletManager::createWalletFromKeys(const QString &path, const QString &
|
||||
delete m_currentWallet;
|
||||
m_currentWallet = NULL;
|
||||
}
|
||||
Monero::Wallet * w = m_pimpl->createWalletFromKeys(path.toStdString(), language.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight,
|
||||
address.toStdString(), viewkey.toStdString(), spendkey.toStdString());
|
||||
Monero::Wallet * w = m_pimpl->createWalletFromKeys(path.toStdString(), "", language.toStdString(), static_cast<Monero::NetworkType>(nettype), restoreHeight,
|
||||
address.toStdString(), viewkey.toStdString(), spendkey.toStdString(), kdfRounds);
|
||||
m_currentWallet = new Wallet(w);
|
||||
return m_currentWallet;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
static WalletManager * instance();
|
||||
// wizard: createWallet path;
|
||||
Q_INVOKABLE Wallet * createWallet(const QString &path, const QString &password,
|
||||
const QString &language, NetworkType::Type nettype = NetworkType::MAINNET);
|
||||
const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
/*!
|
||||
* \brief openWallet - opens wallet by given path
|
||||
@@ -42,17 +42,17 @@ public:
|
||||
* \param nettype - type of network the wallet is running on
|
||||
* \return wallet object pointer
|
||||
*/
|
||||
Q_INVOKABLE Wallet * openWallet(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET);
|
||||
Q_INVOKABLE Wallet * openWallet(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
/*!
|
||||
* \brief openWalletAsync - asynchronous version of "openWallet". Returns immediately. "walletOpened" signal
|
||||
* emitted when wallet opened;
|
||||
*/
|
||||
Q_INVOKABLE void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET);
|
||||
Q_INVOKABLE void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
// wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
|
||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0);
|
||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
||||
|
||||
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
||||
const QString &language,
|
||||
@@ -60,7 +60,8 @@ public:
|
||||
const QString &address,
|
||||
const QString &viewkey,
|
||||
const QString &spendkey = "",
|
||||
quint64 restoreHeight = 0);
|
||||
quint64 restoreHeight = 0,
|
||||
quint64 kdfRounds = 1);
|
||||
|
||||
Q_INVOKABLE Wallet * createWalletFromDevice(const QString &path,
|
||||
const QString &password,
|
||||
|
||||
Reference in New Issue
Block a user