TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by Gabriel Handford.
GHKeychain is a framework for accessing accounts, getting, setting, and deleting items in the system Keychain on Mac OS X and iOS.
This is a fork of SSKeychain.
Add the following to your Podfile if you're using CocoaPods:
pod 'GHKeychain'
NSString *password = @"toomanysecrets";
[GHKeychain setData:[password dataUsingEncoding:NSUTF8StringEncoding]
service:@"MyApp" account:@"frank" error:&error]
NSData *data = [GHKeychain dataForService:@"MyApp" account:kGHKeychainAccountName error:&error];
NSString *checkPassword = [[NSString alloc] initWithData:data encoding:NSUTF8Encoding];
[GHKeychain deleteForService:@"MyApp" account:@"frank" error:&error];
GHKeychain has the following class methods for working with the system keychain:
+ (NSArray *)allAccounts:(NSError **)error;
+ (NSArray *)accountsForService:(NSString *)service error:(NSError **)error;
+ (NSString *)dataForService:(NSString *)service account:(NSString *)account error:(NSError **)error;
+ (BOOL)deleteForService:(NSString *)service account:(NSString *)account error:(NSError **)error;
+ (BOOL)setData:(NSData *)data forService:(NSString *)service account:(NSString *)account error:(NSError **)error;