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

Add ability to specific accessibility on a per-item basis #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/SAMKeychainQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ typedef NS_ENUM(NSUInteger, SAMKeychainQuerySynchronizationMode) {
@property (nonatomic, copy, nullable) NSString *accessGroup;
#endif

/** kSecAttrAccessible (only used on iOS) */
@property (nonatomic, copy, nullable) NSString *accessibility;

#ifdef SAMKEYCHAIN_SYNCHRONIZATION_AVAILABLE
/** kSecAttrSynchronizable */
@property (nonatomic) SAMKeychainQuerySynchronizationMode synchronizationMode;
Expand Down
4 changes: 2 additions & 2 deletions Sources/SAMKeychainQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (BOOL)save:(NSError *__autoreleasing *)error {
query = [[NSMutableDictionary alloc]init];
[query setObject:self.passwordData forKey:(__bridge id)kSecValueData];
#if __IPHONE_4_0 && TARGET_OS_IPHONE
CFTypeRef accessibilityType = [SAMKeychain accessibilityType];
CFTypeRef accessibilityType = self.accessibility ? (__bridge CFTypeRef)self.accessibility : [SAMKeychain accessibilityType];
if (accessibilityType) {
[query setObject:(__bridge id)accessibilityType forKey:(__bridge id)kSecAttrAccessible];
}
Expand All @@ -54,7 +54,7 @@ - (BOOL)save:(NSError *__autoreleasing *)error {
}
[query setObject:self.passwordData forKey:(__bridge id)kSecValueData];
#if __IPHONE_4_0 && TARGET_OS_IPHONE
CFTypeRef accessibilityType = [SAMKeychain accessibilityType];
CFTypeRef accessibilityType = self.accessibility ? (__bridge CFTypeRef)self.accessibility : [SAMKeychain accessibilityType];
if (accessibilityType) {
[query setObject:(__bridge id)accessibilityType forKey:(__bridge id)kSecAttrAccessible];
}
Expand Down