Skip to content

Commit

Permalink
Use "enum Constants" in SettingsStore
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhdk committed Sep 29, 2024
1 parent 748fc4e commit 77bf72e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Sources/Secretive/Helpers/SettingsHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import Foundation

class SettingsStore: ObservableObject {
let service = "com.maxgoedjen.Secretive"
enum Constants {
static let service = "com.maxgoedjen.Secretive"
}
}

extension SettingsStore {
Expand All @@ -18,7 +20,7 @@ extension SettingsStore {
}

let updateQuery: [String: Any] = [kSecClass as String: kSecClassGenericPassword,
kSecAttrServer as String: service]
kSecAttrServer as String: Constants.service]
let attributes: [String: Any] = [kSecAttrAccount as String: key,
kSecValueData as String: valueData]
// FIXME: Make this non-blocking as described here: https://developer.apple.com/documentation/security/1393617-secitemupdate
Expand All @@ -30,7 +32,7 @@ extension SettingsStore {
} else {
let addquery: [String: Any] = [kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: key,
kSecAttrServer as String: service,
kSecAttrServer as String: Constants.service,
kSecValueData as String: valueData]
// FIXME: Make this non-blocking as described here: https://developer.apple.com/documentation/security/1401659-secitemadd
let status = SecItemAdd(addquery as CFDictionary, nil)
Expand All @@ -44,7 +46,7 @@ extension SettingsStore {
get {
let getquery: [String: Any] = [kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: key,
kSecAttrServer as String: service,
kSecAttrServer as String: Constants.service,
kSecMatchLimit as String: kSecMatchLimitOne,
kSecReturnData as String: true]
var item: CFTypeRef?
Expand Down

0 comments on commit 77bf72e

Please sign in to comment.