Skip to content
Merged
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
15 changes: 10 additions & 5 deletions ios/RNSensitiveInfo/RNSensitiveInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,20 @@ - (NSString *)messageForError:(NSError *)error
if (keychainService == NULL) {
keychainService = @"app";
}

NSNumber *sync = options[@"kSecAttrSynchronizable"];
if (sync == NULL)
sync = (__bridge id)kSecAttrSynchronizableAny;

NSData* valueData = [value dataUsingEncoding:NSUTF8StringEncoding];
NSMutableDictionary* search = [NSMutableDictionary dictionaryWithObjectsAndKeys:
(__bridge id)(kSecClassGenericPassword), kSecClass,
keychainService, kSecAttrService,
sync, kSecAttrSynchronizable,
key, kSecAttrAccount, nil];
NSMutableDictionary *query = [search mutableCopy];
[query setValue: valueData forKey: kSecValueData];

if([RCTConvert BOOL:options[@"kSecAttrSynchronizable"]]){
[query setValue:@YES forKey:(NSString *)kSecAttrSynchronizable];
}

if([RCTConvert BOOL:options[@"touchID"]]){
CFStringRef kSecAccessControlValue = convertkSecAccessControl([RCTConvert NSString:options[@"kSecAccessControl"]]);
SecAccessControlRef sac = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, kSecAccessControlValue, NULL);
Expand Down Expand Up @@ -305,11 +306,15 @@ - (void)getItemWithQuery:(NSDictionary *)query resolver:(RCTPromiseResolveBlock)
if (keychainService == NULL) {
keychainService = @"app";
}

NSNumber *sync = options[@"kSecAttrSynchronizable"];
if (sync == NULL)
sync = (__bridge id)kSecAttrSynchronizableAny;

// Create dictionary of search parameters
NSDictionary* query = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge id)(kSecClassGenericPassword), kSecClass,
(__bridge id)(kSecAttrSynchronizableAny), kSecAttrSynchronizable,
sync, kSecAttrSynchronizable,
keychainService, kSecAttrService,
key, kSecAttrAccount,
kCFBooleanTrue, kSecReturnAttributes,
Expand Down