/Keychain

Convenient Swift bindings for Keychain services on iOS and macOS

Primary LanguageSwiftISC LicenseISC

Keychain

Build Status Coverage Documentation

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.

Examples

Generic Passwords

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)