A wrapper to make it really easy to deal with iOS Keychain and store your user's credentials securely.
If you are using Cocoapods, add this line to your
For more information on Cocoapods, check their official documentation.
If you are using Carthage, add the following line to your
For more information about Carthage usage, check their official documentation.
If you are using the Swift Package Manager, open the following menu item in Xcode:
File > Swift Packages > Add Package Dependency...
In the Choose Package Repository prompt add this url:
Then, press Next and complete the remaining steps.
For more information on SPM, check its official documentation.
let jwt = // user's JWT token obtained after login A0SimpleKeychain().setString(jwt, forKey: "auth0-user-jwt")
let jwt = A0SimpleKeychain().string(forKey: "auth0-user-jwt")
let jwt = // user's JWT token obtained after login let keychain = A0SimpleKeychain(service: "Auth0", accessGroup: "ABCDEFGH.com.mydomain.myaccessgroup") keychain.setString(jwt, forKey: "auth0-user-jwt")
Let's save the JWT first:
let jwt = // user's JWT token obtained after login let keychain = A0SimpleKeychain() keychain.useAccessControl = true keychain.defaultAccessiblity = .whenPasscodeSetThisDeviceOnly keychain.setTouchIDAuthenticationAllowableReuseDuration(5.0) keychain.setString(jwt, forKey: "auth0-user-jwt")
If there is an existent value under the key
auth0-user-jwtsaved with AccessControl and
A0SimpleKeychainItemAccessibleWhenPasscodeSetThisDeviceOnly, iOS will prompt the user to enter their passcode or fingerprint before updating the value.
Then let's obtain the value:
let message = NSLocalizedString("Please enter your passcode/fingerprint to login with awesome App!.", comment: "Prompt TouchID message") let keychain = A0SimpleKeychain() let jwt = keychain.string(forKey: "auth0-user-jwt", promptMessage: message)
Just clone the repo, run
carthage bootstrap and you're ready to contribute!
Auth0 helps you to:
If you have found a bug or to request a feature, please raise an issue. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.
|Last commit: 6 days ago|