HYKeychainHelper is a simple tool for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system Keychain on iOS.
- Swift 3
- iOS 10.0+
- Xcode 8+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
Then create Podfile
file into your Xcode project, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
pod 'HYKeychainHelper'
Finially, you will complete it with the following command:
$ pod install
Download and drop /HYKeychainHelper
folder in your project.
The usage of HYKeychainHelper is similar to SSKeychain, so you can easily get started. I specifically provide a simple Demo in order to test HYKeychainHelper function. You can use your bundle ID for testing. Note the bundle ID need Keychain support. if you have question about HYKeychainHelper, you can submit an issue. I will reply to the first time.
It's very simple to use HYKeychainHelper, all external methods are provided in a class method. details as follows:
/// query account's password
HYKeychainHelper.password(service: "your_service_name", account: "your_account_name")
/// add or update an account
HYKeychainHelper.set(password: "your_password", service: "your_service_name", account: "your_account_name")
/// delete an account
HYKeychainHelper.deletePassword(service: "your_service_name", account: "your_account_name")
/// all accounts
HYKeychainHelper.allAccounts(forService: "your_service_name")
For more usage scenarios, please refer to
HYKeychainHelper
for details.
HYKeychainHelper
is developed with Swift 3, so your Swift version must be Swift 3.
- If you need help or you'd like to ask a general question, open an issue;
- If you found a bug, open an issue;
- If you have a feature request, open an issue;
- If you want to contribute, submit a pull request.
HYKeychainHelper is available under the MIT license. See the LICENSE file for more info.