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

Function tokenFromJSONV3

launcher/minecraft/auth/AccountData.cpp:77–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77Token tokenFromJSONV3(const QJsonObject& parent, const char* tokenName)
78{
79 Token out;
80 auto tokenObject = parent.value(tokenName).toObject();
81 if (tokenObject.isEmpty()) {
82 return out;
83 }
84 auto issueInstant = tokenObject.value("iat");
85 if (issueInstant.isDouble()) {
86 out.issueInstant = QDateTime::fromMSecsSinceEpoch(((int64_t)issueInstant.toDouble()) * 1000);
87 }
88
89 auto notAfter = tokenObject.value("exp");
90 if (notAfter.isDouble()) {
91 out.notAfter = QDateTime::fromMSecsSinceEpoch(((int64_t)notAfter.toDouble()) * 1000);
92 }
93
94 auto token = tokenObject.value("token");
95 if (token.isString()) {
96 out.token = token.toString();
97 out.validity = Validity::Assumed;
98 }
99
100 auto refresh_token = tokenObject.value("refresh_token");
101 if (refresh_token.isString()) {
102 out.refresh_token = refresh_token.toString();
103 }
104
105 auto extra = tokenObject.value("extra");
106 if (extra.isObject()) {
107 out.extra = extra.toObject().toVariantMap();
108 }
109 return out;
110}
111
112void profileToJSONV3(QJsonObject& parent, MinecraftProfile p, const char* tokenName)
113{

Callers 1

resumeStateFromV3Method · 0.85

Calls 3

valueMethod · 0.80
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected