Skip to content

Commit

Permalink
Merge pull request #76 from TaloDev/crypto-updates
Browse files Browse the repository at this point in the history
Encrypt saves, update encryption strategy
  • Loading branch information
tudddorrr authored Sep 16, 2024
2 parents 936e757 + be844bc commit 7c133b8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Packages/com.trytalo.talo/Runtime/APIs/SavesAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SavesAPI : BaseAPI
public event Action<GameSave> OnSaveChosen;
public event Action OnSaveLoadingCompleted;

private readonly string _offlineSavesPath = Application.persistentDataPath + "/talo-saves.bin";
private readonly string _offlineSavesPath = Application.persistentDataPath + "/ts.bin";
private IFileHandler<OfflineSavesContent> _fileHandler;

public GameSave[] All
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Request> _requests;

Expand Down
4 changes: 2 additions & 2 deletions Packages/com.trytalo.talo/Runtime/Utils/CryptoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> _fileHandler;

Expand Down Expand Up @@ -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));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ public class SavesFileHandler : IFileHandler<OfflineSavesContent>
public OfflineSavesContent ReadContent(string path)
{
if (!File.Exists(path)) return null;
return JsonUtility.FromJson<OfflineSavesContent>(File.ReadAllText(path));
return JsonUtility.FromJson<OfflineSavesContent>(Talo.Crypto.ReadFileContent(path));
}

public void WriteContent(string path, OfflineSavesContent content)
{
File.WriteAllText(path, JsonUtility.ToJson(content));
Talo.Crypto.WriteFileContent(path, JsonUtility.ToJson(content));
}
}

0 comments on commit 7c133b8

Please sign in to comment.