aboutsummaryrefslogtreecommitdiff
path: root/src/main/oshelper.cpp
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2026-01-29 15:40:14 +0000
committertobtoht <tob@featherwallet.org>2026-01-29 15:40:14 +0000
commit4bb527b200c176145361f7dc233185b6f03c593c (patch)
tree104d34d78ac971ba60d7890898155d40229bd868 /src/main/oshelper.cpp
parentbbd4a0055b9b2a19f70499bdb05d3c0abffb762c (diff)
parent2ddb55059123815bebad0e3c4c0853328275f060 (diff)
downloadmonzero-gui-4bb527b200c176145361f7dc233185b6f03c593c.tar.gz
monzero-gui-4bb527b200c176145361f7dc233185b6f03c593c.tar.xz
monzero-gui-4bb527b200c176145361f7dc233185b6f03c593c.zip
Merge pull request #4556
2ddb550 WizardController: set password for temp wallet (selsta)
Diffstat (limited to 'src/main/oshelper.cpp')
-rw-r--r--src/main/oshelper.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp
index d44fc8c2..2ca0e400 100644
--- a/src/main/oshelper.cpp
+++ b/src/main/oshelper.cpp
@@ -43,6 +43,8 @@
#include <QFileInfo>
#include <QString>
#include <QUrl>
+#include <QByteArray>
+#include <QRandomGenerator>
#ifdef Q_OS_MAC
#include "qt/macoshelper.h"
#endif
@@ -246,6 +248,18 @@ QString OSHelper::temporaryPath() const
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
{
#ifdef Q_OS_WIN