A simple Keychain wrapper for iOS, macOS, tvOS, and watchOS
📚 Documentation • 🚀 Getting Started • 📃 Support Policy • 💬 Feedback
Migrating from 0.x? Check the Migration Guide.
[!IMPORTANT]
Check the Support Policy to learn when dropping Xcode, Swift, and platform versions will not be considered a breaking change.
Open the following menu item in Xcode:
File > Add Packages…
In the Search or Enter Package URL search box enter this URL:
https://github.com/auth0/SimpleKeychain
Then, select the dependency rule and press Add Package.
Add the following line to your Podfile
:
pod 'SimpleKeychain', '~> 1.0'
Then, run pod install
.
Add the following line to your Cartfile
:
github "auth0/SimpleKeychain" ~> 1.0
Then, run carthage bootstrap --use-xcframeworks
.
Learn about more advanced features in Examples ↗
See all the available features in the API documentation ↗
let simpleKeychain = SimpleKeychain()
You can specify a service name under which to save items. By default the bundle identifier of your app is used.
let simpleKeychain = SimpleKeychain(service: "Auth0")
try simpleKeychain.set(accessToken, forKey: "auth0-access-token")
let isStored = try simpleKeychain.hasItem(forKey: "auth0-access-token")
let accessToken = try simpleKeychain.string(forKey: "auth0-access-token")
let accessToken = try simpleKeychain.data(forKey: "auth0-credentials")
let keys = try simpleKeychain.keys()
try simpleKeychain.deleteItem(forKey: "auth0-access-token")
try simpleKeychain.deleteAll()
All methods will throw a SimpleKeychainError
upon failure.
catch let error as SimpleKeychainError {
print(error)
}
This Policy defines the extent of the support for Xcode, Swift, and platform (iOS, macOS, tvOS, and watchOS) versions in SimpleKeychain.
The only supported versions of Xcode are those that can be currently used to submit apps to the App Store. Once a Xcode version becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release.
The minimum supported Swift minor version is the one released with the oldest-supported Xcode version. Once a Swift minor becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release.
We support only the last four major versions of any platform, including the current major version.
Once a platform version becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release. For example, iOS 14 will cease to be supported when iOS 18 gets released, and SimpleKeychain will be able to drop it in a minor release.
In the case of macOS, the yearly named releases are considered a major platform version for the purposes of this Policy, regardless of the actual version numbers.
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
To provide feedback or report a bug, please raise an issue on our issue tracker.
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 is an easy-to-implement, adaptable authentication and authorization platform. To learn more check out Why Auth0?
This project is licensed under the MIT license. See the LICENSE file for more info.