Files
simple64/simple64-gui/netplay/netplay_common.cpp
T
2023-09-01 09:01:10 -06:00

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");
}