From c0a7c52f84bba307c4a52ad88f796aa1a64604dd Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:06:40 +0100 Subject: [PATCH 1/2] encrypt saves content --- .../Runtime/Utils/FileHandlers/SavesFileHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/com.trytalo.talo/Runtime/Utils/FileHandlers/SavesFileHandler.cs b/Packages/com.trytalo.talo/Runtime/Utils/FileHandlers/SavesFileHandler.cs index da42a08..d757073 100644 --- a/Packages/com.trytalo.talo/Runtime/Utils/FileHandlers/SavesFileHandler.cs +++ b/Packages/com.trytalo.talo/Runtime/Utils/FileHandlers/SavesFileHandler.cs @@ -7,11 +7,11 @@ public class SavesFileHandler : IFileHandler public OfflineSavesContent ReadContent(string path) { if (!File.Exists(path)) return null; - return JsonUtility.FromJson(File.ReadAllText(path)); + return JsonUtility.FromJson(Talo.Crypto.ReadFileContent(path)); } public void WriteContent(string path, OfflineSavesContent content) { - File.WriteAllText(path, JsonUtility.ToJson(content)); + Talo.Crypto.WriteFileContent(path, JsonUtility.ToJson(content)); } } From be844bc4bb5f6aa4e2b5a4d7551f4d0271508480 Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:06:58 +0100 Subject: [PATCH 2/2] use unique device id, update file names --- Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs | 2 +- Packages/com.trytalo.talo/Runtime/Utils/ContinuityManager.cs | 2 +- Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs b/Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs index f1656ad..e4d0375 100644 --- a/Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs +++ b/Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs @@ -17,7 +17,7 @@ public class SavesAPI : BaseAPI public event Action OnSaveChosen; public event Action OnSaveLoadingCompleted; - private readonly string _offlineSavesPath = Application.persistentDataPath + "/talo-saves.bin"; + private readonly string _offlineSavesPath = Application.persistentDataPath + "/ts.bin"; private IFileHandler _fileHandler; public GameSave[] All diff --git a/Packages/com.trytalo.talo/Runtime/Utils/ContinuityManager.cs b/Packages/com.trytalo.talo/Runtime/Utils/ContinuityManager.cs index c8b2fec..5635250 100644 --- a/Packages/com.trytalo.talo/Runtime/Utils/ContinuityManager.cs +++ b/Packages/com.trytalo.talo/Runtime/Utils/ContinuityManager.cs @@ -24,7 +24,7 @@ public class ContinuityContent public class ContinuityManager { - private readonly string _continuityPath = Application.persistentDataPath + "/talo-continuity.bin"; + private readonly string _continuityPath = Application.persistentDataPath + "/tc.bin"; private List _requests; diff --git a/Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs b/Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs index 0e51c21..0e56768 100644 --- a/Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs +++ b/Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs @@ -8,7 +8,7 @@ namespace TaloGameServices { public class CryptoManager { - private readonly string _keyPath = Application.persistentDataPath + "/talo-init.bin"; + private readonly string _keyPath = Application.persistentDataPath + "/ti.bin"; private IFileHandler _fileHandler; @@ -52,7 +52,7 @@ private byte[] GetAESKey() { using (var sha256 = SHA256.Create()) { - return sha256.ComputeHash(Encoding.UTF8.GetBytes(Talo.Settings.accessKey)); + return sha256.ComputeHash(Encoding.UTF8.GetBytes(SystemInfo.deviceUniqueIdentifier)); } }