| 394 | } |
| 395 | |
| 396 | QJsonObject AccountData::saveState() const { |
| 397 | QJsonObject output; |
| 398 | if(type == AccountType::Mojang) { |
| 399 | output["type"] = "Mojang"; |
| 400 | if(legacy) { |
| 401 | output["legacy"] = true; |
| 402 | } |
| 403 | if(canMigrateToMSA) { |
| 404 | output["canMigrateToMSA"] = true; |
| 405 | } |
| 406 | } |
| 407 | else if (type == AccountType::MSA) { |
| 408 | output["type"] = "MSA"; |
| 409 | output["msa-client-id"] = msaClientID; |
| 410 | tokenToJSONV3(output, msaToken, "msa"); |
| 411 | tokenToJSONV3(output, userToken, "utoken"); |
| 412 | tokenToJSONV3(output, xboxApiToken, "xrp-main"); |
| 413 | tokenToJSONV3(output, mojangservicesToken, "xrp-mc"); |
| 414 | } else if (type == AccountType::AuthlibInjector) { |
| 415 | output["type"] = "Authlib-Injector"; |
| 416 | output["authlibInjectorUrl"] = authlibInjectorBaseUrl; |
| 417 | } else if (type == AccountType::Offline) { |
| 418 | output["type"] = "Offline"; |
| 419 | } |
| 420 | |
| 421 | tokenToJSONV3(output, yggdrasilToken, "ygg"); |
| 422 | profileToJSONV3(output, minecraftProfile, "profile"); |
| 423 | entitlementToJSONV3(output, minecraftEntitlement); |
| 424 | return output; |
| 425 | } |
| 426 | |
| 427 | QString AccountData::userName() const { |
| 428 | if(type == AccountType::MSA) { |
no test coverage detected