mirror of
https://github.com/simple64/simple64.git
synced 2026-07-25 08:04:00 +02:00
16 lines
624 B
C++
16 lines
624 B
C++
#include "netplay_common.h"
|
|
|
|
void addAuthData(QWebSocket *webSocket, QJsonObject *json)
|
|
{
|
|
QCryptographicHash hash = QCryptographicHash(QCryptographicHash::Sha256);
|
|
QByteArray currentTime = QByteArray::number(QDateTime::currentMSecsSinceEpoch());
|
|
|
|
hash.addData(currentTime);
|
|
// this auth code is emulator specific, and is only checked when the server is running with the --enable-auth option
|
|
hash.addData(QStringLiteral(NETPLAY_AUTH_CODE).toUtf8());
|
|
|
|
json->insert("auth", QString(hash.result().toHex()));
|
|
json->insert("authTime", QString(currentTime));
|
|
json->insert("emulator", "simple64");
|
|
}
|