-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACKeychain.h
executable file
·71 lines (55 loc) · 2.47 KB
/
ACKeychain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// ACKeychain.h
// ACKeychain
//
// Created by Anthony Castelli on 3/23/13.
// Copyright (c) 2013 Emerys. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Security/Security.h>
extern NSString *const ACKeychainPassword;
extern NSString *const ACKeychainUsername;
extern NSString *const ACKeychainIdentifier;
extern NSString *const ACKeychainService;
extern NSString *const ACKeychainExpirationDate;
extern NSString *const ACKeychainInfo;
@interface ACKeychain : NSObject {
}
+ (ACKeychain *)defaultKeychain;
// Creates new item with the provided values and deletes the old ones if those existed.
// Returns YES on success and NO on failure.
- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier forService:(NSString *)service;
- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier info:(NSDictionary *)info forService:(NSString *)service;
- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier expirationDate:(NSDate *)expirationDate forService:(NSString *)service;
/* On success returns a dictionary with the following keys:
* ACKeychainUsername
* ACKeychainPassword
* ACKeychainIdentifier
* ACKeychainService
* ACKeychainExpirationDate
*/
- (NSDictionary *)credentialsForIdentifier:(NSString *)identifier service:(NSString *)service;
/* On success returns a dictionary with the following keys:
* ACKeychainUsername
* ACKeychainPassword
* ACKeychainIdentifier
* ACKeychainService
* ACKeychainExpirationDate
*/
- (NSDictionary *)credentialsForUsername:(NSString *)username service:(NSString *)service;
/* On success returns an array of dictionaries with the following keys:
* ACKeychainUsername
* ACKeychainPassword
* ACKeychainIdentifier
* ACKeychainService
* ACKeychainExpirationDate
*/
// limit - the amount of entries to return. Should be > 0
- (NSArray *)allCredentialsForService:(NSString *)service limit:(NSUInteger)limit;
// Deletes credentials matching the provided identifier and service, returns YES on sucess
- (BOOL)deleteCredentialsForIdentifier:(NSString *)identifier service:(NSString *)service;
// Deletes credentials matching the provided username and service, returns YES on sucess
- (BOOL)deleteCredentialsForUsername:(NSString *)username service:(NSString *)service;
// Deletes all entries for the given service
- (BOOL)deleteAllCredentialsForService:(NSString *)service;
@end