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

Commit d3c7098

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

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ios/RNEncryptedStorage.m

+6-5
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,16 @@ 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 = @{
102-
(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword,
103105
(__bridge id)kSecAttrAccount : key,
106+
(__bridge id)kSecAttrService: keychainService,
104107
(__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
108+
(__bridge id)kSecMatchLimit : (__bridge id)kSecMatchLimitOne
108109
};
109110

110111
CFTypeRef dataRef = NULL;

0 commit comments

Comments
 (0)