MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / tokenToJSONV3

Function tokenToJSONV3

launcher/minecraft/auth/AccountData.cpp:45–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44namespace {
45void tokenToJSONV3(QJsonObject& parent, Token t, const char* tokenName)
46{
47 if (!t.persistent) {
48 return;
49 }
50 QJsonObject out;
51 if (t.issueInstant.isValid()) {
52 out["iat"] = QJsonValue(t.issueInstant.toMSecsSinceEpoch() / 1000);
53 }
54
55 if (t.notAfter.isValid()) {
56 out["exp"] = QJsonValue(t.notAfter.toMSecsSinceEpoch() / 1000);
57 }
58
59 bool save = false;
60 if (!t.token.isEmpty()) {
61 out["token"] = QJsonValue(t.token);
62 save = true;
63 }
64 if (!t.refresh_token.isEmpty()) {
65 out["refresh_token"] = QJsonValue(t.refresh_token);
66 save = true;
67 }
68 if (t.extra.size()) {
69 out["extra"] = QJsonObject::fromVariantMap(t.extra);
70 save = true;
71 }
72 if (save) {
73 parent[tokenName] = out;
74 }
75}
76
77Token tokenFromJSONV3(const QJsonObject& parent, const char* tokenName)
78{

Callers 1

saveStateMethod · 0.85

Calls 3

isValidMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected