Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Support for kSecAttrAccessGroup in Mac OSX 9 >=
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel authored and soffes committed Mar 11, 2016
1 parent 7a99dd5 commit 927bfe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Sources/SSKeychainQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#define SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE 1
#endif

#if __IPHONE_3_0 || __MAC_10_9
// Keychain access group available at compile time
#define SSKEYCHAIN_ACCESS_GROUP_AVAILABLE 1
#endif

#ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE
typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) {
SSKeychainQuerySynchronizationModeAny,
Expand All @@ -41,7 +46,7 @@ typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) {
/** kSecAttrLabel */
@property (nonatomic, copy) NSString *label;

#if __IPHONE_3_0 && TARGET_OS_IPHONE
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
/** kSecAttrAccessGroup (only used on iOS) */
@property (nonatomic, copy) NSString *accessGroup;
#endif
Expand Down
6 changes: 4 additions & 2 deletions Sources/SSKeychainQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @implementation SSKeychainQuery
@synthesize label = _label;
@synthesize passwordData = _passwordData;

#if __IPHONE_3_0 && TARGET_OS_IPHONE
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
@synthesize accessGroup = _accessGroup;
#endif

Expand Down Expand Up @@ -203,11 +203,13 @@ - (NSMutableDictionary *)query {
[dictionary setObject:self.account forKey:(__bridge id)kSecAttrAccount];
}

#if __IPHONE_3_0 && TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
#if !TARGET_IPHONE_SIMULATOR
if (self.accessGroup) {
[dictionary setObject:self.accessGroup forKey:(__bridge id)kSecAttrAccessGroup];
}
#endif
#endif

#ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE
if ([[self class] isSynchronizationAvailable]) {
Expand Down

0 comments on commit 927bfe1

Please sign in to comment.