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
letaccount="user" // A user account, for which the password is used
letservice="service" // A service, e.g., your app name
letlabel="\(account)@\(service)" // Descriptive name
letitem=GenericPasswordItem(for: service, using: account, with: label)
// Store password
tryKeychain.store(password:"foo", in: item)
// Retrieve password
letpassword=tryKeychain.retrievePassword(for: item)
// Update password
tryKeychain.update(password:"bar", for: item)
// Delete item
tryKeychain.delete(item: item)