MCPcopy Create free account
hub / github.com/MultiMC/Launcher / tokenToJSONV3

Function tokenToJSONV3

launcher/minecraft/auth/AccountData.cpp:9–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8namespace {
9void tokenToJSONV3(QJsonObject &parent, Katabasis::Token t, const char * tokenName) {
10 if(!t.persistent) {
11 return;
12 }
13 QJsonObject out;
14 if(t.issueInstant.isValid()) {
15 out["iat"] = QJsonValue(t.issueInstant.toMSecsSinceEpoch() / 1000);
16 }
17
18 if(t.notAfter.isValid()) {
19 out["exp"] = QJsonValue(t.notAfter.toMSecsSinceEpoch() / 1000);
20 }
21
22 bool save = false;
23 if(!t.token.isEmpty()) {
24 out["token"] = QJsonValue(t.token);
25 save = true;
26 }
27 if(!t.refresh_token.isEmpty()) {
28 out["refresh_token"] = QJsonValue(t.refresh_token);
29 save = true;
30 }
31 if(t.extra.size()) {
32 out["extra"] = QJsonObject::fromVariantMap(t.extra);
33 save = true;
34 }
35 if(save) {
36 parent[tokenName] = out;
37 }
38}
39
40Katabasis::Token tokenFromJSONV3(const QJsonObject &parent, const char * tokenName) {
41 Katabasis::Token out;

Callers 1

saveStateMethod · 0.85

Calls 3

isEmptyMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected