Skip to content

Commit 501428b

Browse files
authored
Merge pull request #138 from veged/fix/keychain-secitemupdate-errSecParam
Merging it! Hope it fixed the issue for you and others as well. I do not see this on my side, so hard to check if it helps or not. so Trusting you with it :) Thanks for the contribution!
2 parents b949961 + ce44ae9 commit 501428b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/Fluid/Persistence/KeychainService.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ enum KeychainServiceError: Error, LocalizedError {
1111
return "Failed to convert key data."
1212
case let .unhandled(status):
1313
if let message = SecCopyErrorMessageString(status, nil) as String? {
14-
return message
14+
return "\(message) (OSStatus: \(status))"
1515
}
16-
return "Unhandled Keychain status: \(status)"
16+
return "Unhandled Keychain error (OSStatus: \(status))"
1717
}
1818
}
1919
}
@@ -159,9 +159,12 @@ final class KeychainService {
159159
try self.removeLegacyEntries()
160160
return
161161
case errSecDuplicateItem:
162+
let updateAttributes: [String: Any] = [
163+
kSecValueData as String: data,
164+
]
162165
let updateStatus = SecItemUpdate(
163166
aggregatedQuery() as CFDictionary,
164-
[kSecValueData as String: data] as CFDictionary
167+
updateAttributes as CFDictionary
165168
)
166169
guard updateStatus == errSecSuccess else {
167170
throw KeychainServiceError.unhandled(updateStatus)

0 commit comments

Comments
 (0)