summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2023-03-27 16:42:29 +0200
committerDavid Elsing <david.elsing@posteo.net>2023-03-30 17:36:40 +0200
commit7f98cd01330057ade7cb7f5703b8ca896ecc36ab (patch)
tree856eae770be9b0cc564b6511a89eedde484c3b47
parentImprove choosing screen share type (diff)
downloadnheko-7f98cd01330057ade7cb7f5703b8ca896ecc36ab.tar.xz
Use mtx::client::utils::random_token for XDP session tokens
-rw-r--r--src/voip/ScreenCastPortal.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/voip/ScreenCastPortal.cpp b/src/voip/ScreenCastPortal.cpp
index 41e6c0a2..cce5a375 100644
--- a/src/voip/ScreenCastPortal.cpp
+++ b/src/voip/ScreenCastPortal.cpp
@@ -14,22 +14,13 @@
 #include <QDBusPendingCallWatcher>
 #include <QDBusPendingReply>
 #include <QDBusUnixFileDescriptor>
+#include <mtxclient/utils.hpp>
 #include <random>
 
 static QString
 make_token()
 {
-    thread_local std::random_device rng;
-    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));
+    return QString::fromStdString("nheko" + mtx::client::utils::random_token(64, false));
 }
 
 static QString