Convenient Swift bindings for the Keychain services.
The project is not supporting many Keychain features. If you want more, create or vote for an issue, or create a pull request. Before creating pull requests, you can discuss the intended change by creating an issue first.
- Repository: https://github.com/blochberger/Keychain
- Documentation: https://blochberger.github.io/Keychain
- Issues: https://github.com/blochberger/Keychain/issues
import Keychain
let account = "user" // A user account, for which the password is used
let service = "service" // A service, e.g., your app name
let label = "\(account)@\(service)" // Descriptive name
let item = GenericPasswordItem(for: service, using: account, with: label)
// Store password
try Keychain.store(password: "foo", in: item)
// Retrieve password
let password = try Keychain.retrievePassword(for: item)
// Update password
try Keychain.update(password: "bar", for: item)
// Delete item
try Keychain.delete(item: item)