Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 68 lines (51 sloc) 3.01 kB
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
1 //
2 // Lockbox.h
3 //
4 // Created by Mark H. Granoff on 4/19/12.
5 // Copyright (c) 2012 Hawk iMedia. All rights reserved.
6 //
7
50499ce @compressed Subclass NSObject
compressed authored
8 @interface Lockbox : NSObject
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
9
2cf2771 @granoff Add the ability to instantiate your own Lockbox instance, specificall…
authored
10 #ifdef DEBUG
11 // For unit tests
12 @property (strong, nonatomic, readonly) NSString *keyPrefix;
13 #endif
14
15 // When the default key prefix (your app's bundle id) is not sufficient, instantiate your own
16 // instance of Lockbox specifying your own key prefix, and use the appropriate instance methods
17 // to store and retreive keychain data. You can also instantiate your own instance and use the
18 // default key prefix simply by calling [[Lockbox alloc] init];
19 -(instancetype)initWithKeyPrefix:(NSString *)keyPrefix;
20
21 // When adding instance methods, remember to add a corresponding class method.
22
23 -(BOOL)setString:(NSString *)value forKey:(NSString *)key;
24 -(BOOL)setString:(NSString *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
25 -(NSString *)stringForKey:(NSString *)key;
26
27 -(BOOL)setArray:(NSArray *)value forKey:(NSString *)key;
28 -(BOOL)setArray:(NSArray *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
29 -(NSArray *)arrayForKey:(NSString *)key;
30
31 -(BOOL)setSet:(NSSet *)value forKey:(NSString *)key;
32 -(BOOL)setSet:(NSSet *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
33 -(NSSet *)setForKey:(NSString *)key;
34
35 -(BOOL)setDictionary:(NSDictionary *)value forKey:(NSString *)key;
36 -(BOOL)setDictionary:(NSDictionary *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
37 -(NSDictionary *)dictionaryForKey:(NSString *)key;
38
39 -(BOOL)setDate:(NSDate *)value forKey:(NSString *)key;
40 -(BOOL)setDate:(NSDate *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
41 -(NSDate *)dateForKey:(NSString *)key;
42
43 // Class methods that maintain the convenience of storing and retrieving data from the keychain
44 // using class-level methods. An internal instance of Lockbox is instantiated for the class that
45 // uses the instance methods above, and a key prefix equal to your app's bundle id.
46
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
47 +(BOOL)setString:(NSString *)value forKey:(NSString *)key;
84ec4bd @erikr Add support for using a custom kSecAttrAccessible for all setter meth…
erikr authored
48 +(BOOL)setString:(NSString *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
49 +(NSString *)stringForKey:(NSString *)key;
50
51 +(BOOL)setArray:(NSArray *)value forKey:(NSString *)key;
84ec4bd @erikr Add support for using a custom kSecAttrAccessible for all setter meth…
erikr authored
52 +(BOOL)setArray:(NSArray *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
53 +(NSArray *)arrayForKey:(NSString *)key;
54
55 +(BOOL)setSet:(NSSet *)value forKey:(NSString *)key;
84ec4bd @erikr Add support for using a custom kSecAttrAccessible for all setter meth…
erikr authored
56 +(BOOL)setSet:(NSSet *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
57 +(NSSet *)setForKey:(NSString *)key;
58
3495391 @rivera-ernesto Add support for NSDictionary objects
rivera-ernesto authored
59 +(BOOL)setDictionary:(NSDictionary *)value forKey:(NSString *)key;
60 +(BOOL)setDictionary:(NSDictionary *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
61 +(NSDictionary *)dictionaryForKey:(NSString *)key;
62
d2b449c @granoff Integrated jklundell's NSDate support, and added unit tests for same
authored
63 +(BOOL)setDate:(NSDate *)value forKey:(NSString *)key;
64 +(BOOL)setDate:(NSDate *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility;
65 +(NSDate *)dateForKey:(NSString *)key;
66
1bf0ef9 @granoff Initial commit of Lockbox class and sample project.
authored
67 @end
Something went wrong with that request. Please try again.