/EncryptedAppStorage

Secure your sensitive data in SwiftUI project with ease @EncryptedAppStorage("sensitiveData") var sensitiveData = "Sensitive Data"

Primary LanguageSwiftMIT LicenseMIT

πŸ₯·βŒ EncryptedAppStorage

@AppStorage is built on top of UserDefaults, which is not secure storage. Which mean, you should not save your sensitive data using @AppStorage, because it’s easy for hacker to attack. Which @EncryptedAppStorage, your sensitive data will be saved in KeyChain. Once stored in Keychain this information is only available to your app, other apps can't see it. Besides that, operating system makes sure this information is kept and processed securely.

Twitter Swift Swift Package Manager

Usage

@EncryptedAppStorage can work with any types of value. If you assign the default value, then that value will be stored in KeyChain if it has no value there.

@EncryptedAppStorage(<#StoreKey#>)
var sensitiveString = "Sensitive String"
@EncryptedAppStorage(<#StoreKey#>)
var sensitiveInt = 100
struct MyObject: Codable {
    var name: String
}

@EncryptedAppStorage(<#StoreKey#>)
var myObject: MyObject? = nil

πŸ›  Compatibility

  • macOS 11.0+
  • iOS 14.0+
  • iPadOS 14.0+
  • tvOS 14.0+
  • watchOS 7.0+

βš™οΈ Installation

Only available with Swift Package Manager

🍻 PRs are welcome

πŸ‘¨β€πŸ’» Author

Khuong – @khuong291