Keychain access wrapper for macOS/iOS written in Swift. locksmith provides a simple and secure way to store and retrieve sensitive data using the iOS Keychain.
- Save data securely in the Keychain using Codable protocol.
- Retrieve and decode data from the Keychain.
- Delete stored data from the Keychain.
You can install Wheel using the Swift Package Manager by adding the following line to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/swiftDevelopmentPackages/locksmith.git", from: "1.0.0")
]
Then, add wheel to your target's dependencies:
targets: [
.target(name: "YourTarget", dependencies: ["locksmith"]),
]
Or, simply add using XCode's package dependencies tab.
locksmith supports accessGroup
identifier for an optional keychain sharing accross different apps and extensions.
let locksmith = Locksmith(service: "com.example.keychain", accessGroup: "your.access.group")
let dataToSave = "Secret Data"
locksmith.save(key: "secretKey", value: dataToSave)
if let retrievedData: String = locksmith.read(key: "secretKey") {
print("Retrieved Data: \(retrievedData)")
}
locksmith.delete(key: "secretKey")