Skip to content

Commit

Permalink
Merge pull request soffes#93 from mAu888/add_error_parameters
Browse files Browse the repository at this point in the history
Add error parameters to keychain accessor methods
  • Loading branch information
soffes committed Mar 25, 2015
2 parents f360e14 + d649ee8 commit 1fd9792
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions SSKeychain/SSKeychain.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ extern NSString *const kSSKeychainWhereKey;
accounts. The order of the objects in the array isn't defined.
*/
+ (NSArray *)allAccounts;
+ (NSArray *)allAccounts:(NSError *__autoreleasing *)error;


/**
Expand All @@ -128,6 +129,7 @@ extern NSString *const kSSKeychainWhereKey;
doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined.
*/
+ (NSArray *)accountsForService:(NSString *)serviceName;
+ (NSArray *)accountsForService:(NSString *)serviceName error:(NSError *__autoreleasing *)error;


#pragma mark - Configuration
Expand Down
18 changes: 14 additions & 4 deletions SSKeychain/SSKeychain.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,24 @@ + (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName acco


+ (NSArray *)allAccounts {
return [self accountsForService:nil];
return [self allAccounts:nil];
}


+ (NSArray *)allAccounts:(NSError *__autoreleasing *)error {
return [self accountsForService:nil error:error];
}


+ (NSArray *)accountsForService:(NSString *)serviceName {
SSKeychainQuery *query = [[SSKeychainQuery alloc] init];
query.service = serviceName;
return [query fetchAll:nil];
return [self accountsForService:serviceName error:nil];
}


+ (NSArray *)accountsForService:(NSString *)serviceName error:(NSError *__autoreleasing *)error {
SSKeychainQuery *query = [[SSKeychainQuery alloc] init];
query.service = serviceName;
return [query fetchAll:error];
}


Expand Down

0 comments on commit 1fd9792

Please sign in to comment.