/// <summary> /// Generates a spoof key asynchronously. /// </summary> /// <returns> The task used for generating the spoof key. </returns> private async Task GenerateSpoofKey() { string key = await Task.Run(() => RandomString.Secure.SHA3.GetString(PASSWORD_LENGTH)).ConfigureAwait(false); string value = await Task.Run(() => RandomString.Secure.SHA3.GetString()).ConfigureAwait(false); MainThreadExecutor.QueueAction(() => SecurePlayerPrefsAsync.SetString(key, value)); }
/// <summary> /// Generates the correct PlayerPref keys for the given wallet number. /// </summary> /// <param name="walletAddress"> The wallet address to set the PlayerPrefs up for. </param> /// <param name="onPrefsGenerated"> The action to call once all PlayerPrefs have been generated. </param> private void GenerateCorrectKeys(string walletAddress, Action onPrefsGenerated) { prefCounter = 0; prefDictionary.Keys.ForEach(key => SecurePlayerPrefsAsync.SetString((key + "_" + walletAddress).Keccak_256(), prefDictionary[key].GetBase64String(), () => { if (++prefCounter >= PREF_COUNT) { onPrefsGenerated?.Invoke(); } })); }