Helps you define secure storages for your properties using Swift property wrappers.
All keys are hashed using SHA512 and all values are encrypted using AES-GCM to keep user information safe, automagically. Symmetric key and nonce, are stored in Keychain in a totally secure way.
This property wrapper will store your property in UserDefaults using StoreKey
(any String
but i recommend you a String typed enum).
@UserDefault(<#StoreKey#>) var yourProperty: YourType?
UserDefaultsStorage
is also available, a subclass of UserDefaults
with all the security provided by this library.
This property wrapper will store your property in Keychain using StoreKey
.
@Keychain(<#StoreKey#>) var yourProperty: YourType?
As UserDefaultsStorage
, KeychainStorage
is also available.
This property wrapper will store your property in a memory singleton, every property with the same wrapper and key can access or modify the value from wherever it is.
@Singleton(<#StoreKey#>) var yourProperty: YourType?
As KeychainStorage
, SingletonStorage
is also available.
This is a custom wrapper, you can define your own Storage
protocol implementation.
@Store(<#Storage#>, <#StoreKey#>) var yourProperty: YourType?
As SingletonStorage
, DelegatedStorage
is also available with all the magic of this library.
- macOS 10.15+
- iOS 13.0+
- iPadOS 13.0+
- tvOS 13.0+
- watchOS 6.0+
You can use the Swift Package Manager by declaring SecurePropertyStorage as a dependency in your Package.swift
file:
.package(url: "https://github.com/alexruperez/SecurePropertyStorage", from: "0.1.0")
You have a series of products that you can choose:
- SecurePropertyStorage: All property wrappers, by default.
- UserDefault: @UserDefault property wrapper.
- Keychain: @Keychain property wrapper.
- Singleton: @Singleton property wrapper.
- Storage: @Store property wrapper.
For more information, see the Swift Package Manager documentation.
Or you can use Carthage:
github "alexruperez/SecurePropertyStorage"
- Featured in Dave Verwer's iOS Dev Weekly - Issue 450, thanks Dave!
- Contributions are very welcome.
- Attribution is appreciated (let's spread the word!), but not mandatory.
Alex Rupérez – @alexruperez – [email protected]
SecurePropertyStorage is available under the MIT license. See the LICENSE file for more info.