Skip to content

alexruperez/SecurePropertyStorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎁 PropertyWrappers

Helps you define storages for your properties using Swift property wrappers.

Twitter Swift Swift Package Manager compatible Carthage compatible License Build Status Coverage

🌟 Features

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.

@UserDefault

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.

@Keychain

This property wrapper will store your property in Keychain using StoreKey.

@Keychain(<#StoreKey#>) var yourProperty: YourType?

As UserDefaultsStorage, KeychainStorage is also available.

@Singleton

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.

@Store

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.

🛠 Compatibility

  • macOS 10.15+
  • iOS 13.0+
  • iPadOS 13.0+
  • tvOS 13.0+
  • watchOS 6.0+

⚙️ Installation

You can use the Swift Package Manager by declaring PropertyWrappers as a dependency in your Package.swift file:

.package(url: "https://github.com/alexruperez/PropertyWrappers", from: "0.1.0")

You have a series of products that you can choose:

  • PropertyWrappers: 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/PropertyWrappers"

🍻 Etc.

  • Contributions are very welcome.
  • Attribution is appreciated (let's spread the word!), but not mandatory.

👨‍💻 Author

Alex Rupérez – @alexruperezcontact@alexruperez.com

👮‍♂️ License

PropertyWrappers is available under the MIT license. See the LICENSE file for more info.