Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Fix SecItemUpdate errSecParam error on Keychain update

Sergey Berezhnoy6b284e1514fd
diff --git a/Sources/Fluid/Persistence/KeychainService.swift b/Sources/Fluid/Persistence/KeychainService.swift
index 81c1262a..014079f5 100644
--- a/Sources/Fluid/Persistence/KeychainService.swift
+++ b/Sources/Fluid/Persistence/KeychainService.swift
@@ -11,9 +11,9 @@ enum KeychainServiceError: Error, LocalizedError {
return "Failed to convert key data."
case let .unhandled(status):
if let message = SecCopyErrorMessageString(status, nil) as String? {
- return message
+ return "\(message) (OSStatus: \(status))"
}
- return "Unhandled Keychain status: \(status)"
+ return "Unhandled Keychain error (OSStatus: \(status))"
}
}
}
@@ -159,9 +159,13 @@ final class KeychainService {
try self.removeLegacyEntries()
return
case errSecDuplicateItem:
+ let updateAttributes: [String: Any] = [
+ kSecValueData as String: data,
+ kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlock,
+ ]
let updateStatus = SecItemUpdate(
aggregatedQuery() as CFDictionary,
- [kSecValueData as String: data] as CFDictionary
+ updateAttributes as CFDictionary
)
guard updateStatus == errSecSuccess else {
throw KeychainServiceError.unhandled(updateStatus)