File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
AmplifyPlugins/Core/AWSPluginsCore/Keychain Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -148,14 +148,18 @@ public struct KeychainStore: KeychainStoreBehavior {
148
148
let fetchStatus = SecItemCopyMatching ( getQuery as CFDictionary , nil )
149
149
switch fetchStatus {
150
150
case errSecSuccess:
151
-
151
+ #if os(macOS)
152
+ SecItemDelete ( getQuery as CFDictionary )
153
+ fallthrough
154
+ #else
152
155
var attributesToUpdate = [ String: Any] ( )
153
156
attributesToUpdate [ Constants . ValueData] = value
154
157
155
158
let updateStatus = SecItemUpdate ( getQuery as CFDictionary , attributesToUpdate as CFDictionary )
156
159
if updateStatus != errSecSuccess {
157
160
throw KeychainStoreError . securityError ( updateStatus)
158
161
}
162
+ #endif
159
163
case errSecItemNotFound:
160
164
var attributesToSet = attributes. defaultSetQuery ( )
161
165
attributesToSet [ Constants . AttributeAccount] = key
Original file line number Diff line number Diff line change @@ -20,8 +20,10 @@ extension KeychainStoreAttributes {
20
20
func defaultGetQuery( ) -> [ String : Any ] {
21
21
var query : [ String : Any ] = [
22
22
KeychainStore . Constants. Class: itemClass,
23
- KeychainStore . Constants. AttributeService: service
23
+ KeychainStore . Constants. AttributeService: service,
24
+ KeychainStore . Constants. UseDataProtectionKeyChain: kCFBooleanTrue
24
25
]
26
+
25
27
if let accessGroup = accessGroup {
26
28
query [ KeychainStore . Constants. AttributeAccessGroup] = accessGroup
27
29
}
You can’t perform that action at this time.
0 commit comments