You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GenericPasswordKeychainItemKeyValueStore: Key-Value Store implementation that stores data into a Generic Password Keychain Item.
Value data is stored as a NSMutableDictionary and serialized using NSKeyedArchiver.
Clone this repository or download a snapshot of it directly inside your project's Assets or Packages folder.
Basic usage
usingGilzoide.KeyValueStore.AppleKeychain;usingUnityEngine;// 1. Instantiate a GenericPasswordKeychainItemKeyValueStore with the Keychain Item attributesvarkeychainItemAttributes=newGenericPasswordKeychainAttributes{Service=Application.identifier,Description="Small secrets used by the game",IsSynchronizable=true,// synchronizable with iCloud};varkvs=newGenericPasswordKeychainItemKeyValueStore(keychainItemAttributes);// 2. Set/Get/Delete valueskvs.SetBool("finishedTutorial",true);kvs.SetString("username","gilzoide");Debug.Log("Checking if values exist: "+kvs.HasKey("username"));Debug.Log("Getting values: "+kvs.GetInt("username"));Debug.Log("Getting values with fallback: "+kvs.GetString("username","default username"));// Like C# Dictionary, this idiom returns a bool if the key is foundif(kvs.TryGetString("someKey",outstringfoundValue)){Debug.Log("'someKey' exists: "+foundValue);}kvs.DeleteKey("someKey");// 3. Save the updated data into the keychainkvs.Save();// 4. Dispose of the GenericPasswordKeychainItemKeyValueStore when done// This ensures the native data gets released correctlykvs.Dispose();
About
Key-Value Store implementation for Unity backed by macOS/iOS/tvOS/visionOS Keychain services