mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Use mtx::client::utils::random_token for XDP session tokens
This commit is contained in:
parent
2aadc7c2c4
commit
7f98cd0133
1 changed files with 2 additions and 11 deletions
|
@ -14,22 +14,13 @@
|
||||||
#include <QDBusPendingCallWatcher>
|
#include <QDBusPendingCallWatcher>
|
||||||
#include <QDBusPendingReply>
|
#include <QDBusPendingReply>
|
||||||
#include <QDBusUnixFileDescriptor>
|
#include <QDBusUnixFileDescriptor>
|
||||||
|
#include <mtxclient/utils.hpp>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
make_token()
|
make_token()
|
||||||
{
|
{
|
||||||
thread_local std::random_device rng;
|
return QString::fromStdString("nheko" + mtx::client::utils::random_token(64, false));
|
||||||
std::uniform_int_distribution<char> index_dist(0, 9);
|
|
||||||
|
|
||||||
std::string token;
|
|
||||||
token.reserve(5 + 64);
|
|
||||||
token += "nheko";
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 64; ++i)
|
|
||||||
token.push_back('0' + index_dist(rng));
|
|
||||||
|
|
||||||
return QString::fromStdString(std::move(token));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
|
|
Loading…
Reference in a new issue