Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 0fa74ff

Browse files
committed
fix: use only kSecClassGenericPassword unique key attributes on getItem
1 parent 81725f9 commit 0fa74ff

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

ios/RNEncryptedStorage.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@ CFStringRef getKeychainAccessibility(NSDictionary *options)
9696

9797
RCT_EXPORT_METHOD(getItem:(NSString *)key withOptions:(NSDictionary *) options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
9898
{
99-
CFStringRef keychainAccessibility = getKeychainAccessibility(options);
10099
NSString *keychainService = getKeychainService(options);
100+
/*
101+
The unique key for kSecClassGenericPassword is composed of: kSecAttrAccount and kSecAttrService
102+
https://stackoverflow.com/a/22519700
103+
*/
101104
NSDictionary* getQuery = @{
102105
(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword,
103106
(__bridge id)kSecAttrAccount : key,
107+
(__bridge id)kSecAttrService: keychainService,
104108
(__bridge id)kSecReturnData : (__bridge id)kCFBooleanTrue,
105-
(__bridge id)kSecMatchLimit : (__bridge id)kSecMatchLimitOne,
106-
(__bridge id)kSecAttrAccessible: (__bridge id)keychainAccessibility,
107-
(__bridge id)kSecAttrService: keychainService
109+
(__bridge id)kSecMatchLimit : (__bridge id)kSecMatchLimitOne
108110
};
109111

110112
CFTypeRef dataRef = NULL;

0 commit comments

Comments
 (0)