Skip to content

Secured Game Saves

Elijah Brown edited this page Mar 14, 2024 · 5 revisions

image

About Module

The Secured Saves module allows you to store your data on the user's device in encrypted form. It is also recommended to use it together with Memory Protector - which simplifies working with objects in memory.

image

Module serialize your objects using JSON and Encryption Providers such as AES, DES, and other popular encryption methods available to you. The module uses the Unity Crypto Library, which is already included in GameShield. Standard .Net methods are used for serialization/deserialization to files

Get Started

You can provide auto-configuration using Setup Wizzard or setup module manual:

// Initialize Module
Core.GameShield.Main.AddModule<SecuredSaves>();

// Get Module for API Requests
Core.GameShield.Main.GetModule<SecuredSaves>().PauseDetector(true);

Unified for all modules Cheating Detection Event:

// Get Information when cheating detected
EventMessenger.Main.Subscribe<SecurityWarningPayload>(payload => {
    // Work with payload
});

Working with Save Files:

// Save your Games
Core.GameShield.Main.GetModule<SecuredSaves>().SaveGame("path_to_save", mysaveobj, () => {
   // Save complete
}, error => {
   // Save Error
});

// Load your games            
Core.GameShield.Main.GetModule<SecuredSaves>().LoadGame<TypeOfSave>("path_to_save", (saveData, mysaveobj) => {
   // Load Complete, work with mysaveobj
}, error => {
   // Load Error
});

You can also change default CryptoProvider with ICryptoProvider interface:

Core.GameShield.Main.GetModule<SecuredSaves>().SetCryptoProvider(new AESProvider(new AESEncryptionOptions {}));

API Reference

This module provide IShieldModule interface methods with own functional extension:

Method Usage
SetupModule Setup Current Module with configuration and force reinitialization if it needed
Disconnect Disconnect Current Module
PauseDetector Pause / Resume cheating detection for current module
IsPaused Check if current module is paused
GetModuleInfo Get Current Module info (used in assemblies searching)
SaveGame (generic) Save your game (serialize object to encrypted json file using one of encryption provider)
LoadGame (generic) Load your game (deserialize object from encrypted json file using one of encryption provider)
HasSave Check if save file is exists
SetCryptoProvider Set current crypto provider (by default AESProvider)
GetCryptoProvider Get current crypto provider

GameShield Wiki