1 image
Author
Description
Keychain is a wrapper library built around a small subset of features offered by Keychain Services to simplify saving and retrieving data to and from the iOS Keychain using kSecClassGenericPassword class.
While the Keychain Services offer comprehensive set of APIs and could be used directly, the app-side implementation for saving and retrieving data will most likely be verbose.
In a nutshell, to securely store an item using Keychain Services, a dictionary of predefined keys and values, also referred to as the keychain query, must be created first. This query must contain valid values for predefined set of keys that depend on a security class being used. To reduce the amount of manual work required to create a keychain query, this framework takes advantage of Swift features such as default implementation for protocols, generics and Codable for automatic encoding of models into external representation.
This approach leads to a much cleaner interaction with iOS Keychain that's enjoyable to use.