| 75 | } |
| 76 | |
| 77 | Token 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 | |
| 112 | void profileToJSONV3(QJsonObject& parent, MinecraftProfile p, const char* tokenName) |
| 113 | { |
no test coverage detected