fix:feature-parity

This commit is contained in:
intelligence committed 2026-08-29 20:25:14 +02:00
1 parent 6c0a6eb498
commit c33d87b06e
8 files changed
+196 -33

No files matched your search

+9 -5
View File
@@ -1,15 +1,19 @@
import Foundation
import Security
enum KeychainAccount: String {
case hosted = "remote-api-key"
case local = "local-api-key"
}
enum KeychainStore {
private static let service = "io.github.transui.macos"
private static let account = "remote-api-key"
static func read() -> String {
static func read(_ account: KeychainAccount) -> String {
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: service,
kSecAttrAccount as String: account,
kSecAttrAccount as String: account.rawValue,
kSecReturnData as String: true,
kSecMatchLimit as String: kSecMatchLimitOne,
]
@@ -20,11 +24,11 @@ enum KeychainStore {
return String(data: data, encoding: .utf8) ?? ""
}
static func write(_ value: String) {
static func write(_ value: String, account: KeychainAccount) {
let identity: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: service,
kSecAttrAccount as String: account,
kSecAttrAccount as String: account.rawValue,
]
if value.isEmpty {
SecItemDelete(identity as CFDictionary)