Feat[auth]: move tokens to keychain
Previously, tokens were saved in json under plain text, making it insecure. Now, they are stored in iOS's keychian with the hope of making it more secure.
This commit is contained in:
1 parent
208503dd18
commit
28df9fcc68
6 files changed
+109
-19
No files matched your search
@@ -21,7 +21,10 @@ public class MinecraftAccount
|
||||
}
|
||||
|
||||
public static MinecraftAccount parse(String content) throws JsonSyntaxException {
|
||||
return Tools.GLOBAL_GSON.fromJson(content, MinecraftAccount.class);
|
||||
MinecraftAccount account = Tools.GLOBAL_GSON.fromJson(content, MinecraftAccount.class);
|
||||
// Read access token from keychain
|
||||
account.accessToken = getAccessTokenFromKeychain(account.xuid);
|
||||
return account;
|
||||
}
|
||||
|
||||
public static MinecraftAccount load(String name) throws IOException, JsonSyntaxException {
|
||||
@@ -39,16 +42,9 @@ public class MinecraftAccount
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
/*
|
||||
public static void clearTempAccount() {
|
||||
File tempAccFile = new File(Tools.DIR_BUNDLE, "cache/tempacc.json");
|
||||
tempAccFile.delete();
|
||||
}
|
||||
|
||||
public static void saveTempAccount(MinecraftAccount acc) throws IOException {
|
||||
File tempAccFile = new File(Tools.DIR_DATA, "cache/tempacc.json");
|
||||
tempAccFile.delete();
|
||||
acc.save(tempAccFile.getAbsolutePath());
|
||||
static {
|
||||
System.load(System.getenv("BUNDLE_PATH") + "/PojavLauncher");
|
||||
}
|
||||
*/
|
||||
public static native String getAccessTokenFromKeychain(String xuid);
|
||||
}
|
||||
Reference in new issue
Block a user