mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-01 21:47:26 -04:00
WizardController: set password for temp wallet
This commit is contained in:
@@ -43,6 +43,8 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "qt/macoshelper.h"
|
#include "qt/macoshelper.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -246,6 +248,18 @@ QString OSHelper::temporaryPath() const
|
|||||||
return QDir::tempPath();
|
return QDir::tempPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString OSHelper::randomPassword(int numBytes) const
|
||||||
|
{
|
||||||
|
numBytes = qBound(16, numBytes, 128);
|
||||||
|
|
||||||
|
QByteArray buf(numBytes, Qt::Uninitialized);
|
||||||
|
auto *rng = QRandomGenerator::system();
|
||||||
|
for (int i = 0; i < numBytes; ++i)
|
||||||
|
buf[i] = char(rng->generate() & 0xFF);
|
||||||
|
|
||||||
|
return QString::fromLatin1(buf.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals));
|
||||||
|
}
|
||||||
|
|
||||||
bool OSHelper::installed() const
|
bool OSHelper::installed() const
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
|
Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
|
||||||
Q_INVOKABLE QString temporaryFilename() const;
|
Q_INVOKABLE QString temporaryFilename() const;
|
||||||
Q_INVOKABLE QString temporaryPath() const;
|
Q_INVOKABLE QString temporaryPath() const;
|
||||||
|
Q_INVOKABLE QString randomPassword(int numBytes = 32) const;
|
||||||
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
|
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
|
||||||
Q_INVOKABLE bool isCapsLock() const;
|
Q_INVOKABLE bool isCapsLock() const;
|
||||||
Q_INVOKABLE quint8 getNetworkTypeFromFile(const QString &keysPath) const;
|
Q_INVOKABLE quint8 getNetworkTypeFromFile(const QString &keysPath) const;
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ Rectangle {
|
|||||||
console.log("Creating temporary wallet", tmp_wallet_filename)
|
console.log("Creating temporary wallet", tmp_wallet_filename)
|
||||||
var nettype = appWindow.persistentSettings.nettype;
|
var nettype = appWindow.persistentSettings.nettype;
|
||||||
var kdfRounds = appWindow.persistentSettings.kdfRounds;
|
var kdfRounds = appWindow.persistentSettings.kdfRounds;
|
||||||
var wallet = walletManager.createWallet(tmp_wallet_filename, "", persistentSettings.language_wallet, nettype, kdfRounds)
|
var wallet = walletManager.createWallet(tmp_wallet_filename, oshelper.randomPassword(), persistentSettings.language_wallet, nettype, kdfRounds)
|
||||||
|
|
||||||
wizardController.walletOptionsSeed = wallet.seed
|
wizardController.walletOptionsSeed = wallet.seed
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ Rectangle {
|
|||||||
var deviceName = wizardController.walletOptionsDeviceName;
|
var deviceName = wizardController.walletOptionsDeviceName;
|
||||||
|
|
||||||
connect();
|
connect();
|
||||||
walletManager.createWalletFromDeviceAsync(tmpWalletFilename, "", nettype, deviceName, restoreHeight, subaddressLookahead, kdfRounds);
|
walletManager.createWalletFromDeviceAsync(tmpWalletFilename, oshelper.randomPassword(), nettype, deviceName, restoreHeight, subaddressLookahead, kdfRounds);
|
||||||
creatingWalletDeviceSplash();
|
creatingWalletDeviceSplash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user