Files
2024-06-19 13:02:08 -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");
}