Skip to content

Instantly share code, notes, and snippets.

@airspeedswift
Forked from justin/gist:f8c0a153aa7d7c9595ee
Last active August 29, 2015 14:06
Show Gist options
  • Save airspeedswift/6c7051b427fa60534c41 to your computer and use it in GitHub Desktop.
Save airspeedswift/6c7051b427fa60534c41 to your computer and use it in GitHub Desktop.
import KeychainAPI
let keychain: Keychain = Keychain(service: "com.secondgear.myapp", accessibility: Accessibility.WhenUnlocked)
let userAccount = Account(userName: "[email protected]", secret: "lovesecretsexgod")
keychain.add(userAccount)
if let fetchedAccount = keychain.accountFor("[email protected]")
{
fetchedAccount.secret = "newpassword"
keychain.update(fetchedAccount)
keychain.remove(fetchedAccount!);
}
else {
// handle failure
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment