Skip to content

frostland/KeychainKit

Repository files navigation

KeychainKit

Yet another Security framework wrapper.

Usage

let data = Data("Hello world!".utf8)
let keychainID = "fr.frostland.Keychain.testBasicStorage"

/* Set some data in the keychain. */
try Keychain.GenericPassword(service: keychainID)
   .upsertInKeychain(updatedAttributes: .init(value: data))

/* Retrieve the data from the keychain. */
let storedData = try Keychain.GenericPassword(service: keychainID)
   .fetchAnyMatchingFromKeychain(retrieveProtectedData: true)?
   .protectedData
assert(data == storedData) /* This should be true */

/* Delete some data from the keychain. */
try Keychain.GenericPassword(service: keychainID)
   .deleteFromKeychain()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages