Secure Settings store (#831)

* Add SettingsStore

* Use keychain instead of UserDefaults in JustUpdatedChecker.swift

* Add ability disable the SSH comment via settings

* Make SettingsStore functions non-static, re-implement them as
subscripts and make settingsStore an environmentObject

Fixes: https://github.com/maxgoedjen/secretive/pull/536#discussion_r1508446459

* Add rawValues for CommentStyle enum

* Use SettingsStore for querying the comment style in SecretDetailView

Fixes: https://github.com/maxgoedjen/secretive/pull/536#discussion_r1509655340

* Revert "Use keychain instead of UserDefaults in JustUpdatedChecker.swift"

This reverts commit ae8a21a1bf7f9e2d04fcb83c4543995db0111325.

* Remove copyright info

* Use "enum Constants" in SettingsStore

* WIP

* Cleanup

* Cleanup

* Cleanup strings

* WIP

* Cleanup

* Cleanup

* Cleanup

* Cleanup

* Cleanup

---------

Co-authored-by: Paul Heidekrüger <paul.heidekrueger@tum.de>
This commit is contained in:
Max Goedjen
2026-09-07 19:35:25 -07:00
committed by GitHub
parent 59aca9327f
commit 0a4f15e789
6 changed files with 176 additions and 4 deletions

View File

@@ -4,10 +4,11 @@ import SecureEnclaveSecretKit
import SmartCardSecretKit
import Brief
import CertificateKit
import SettingsKit
@main
struct Secretive: App {
@Environment(\.agentLaunchController) var agentLaunchController
@Environment(\.justUpdatedChecker) var justUpdatedChecker
@@ -16,6 +17,7 @@ struct Secretive: App {
ContentView()
.environment(EnvironmentValues._secretStoreList)
.environment(EnvironmentValues._certificateStore)
.environment(EnvironmentValues._settingsStore)
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
Task {
@AppStorage("defaultsHasRunSetup") var hasRunSetup = false
@@ -42,6 +44,9 @@ struct Secretive: App {
}
.windowStyle(.hiddenTitleBar)
.windowResizability(.contentSize)
Settings {
SettingsView()
}
}
}
@@ -101,8 +106,9 @@ extension EnvironmentValues {
return list
}()
@MainActor fileprivate static let _certificateStore: CertificateStore = CertificateStore()
@MainActor fileprivate static let _certificateStore = CertificateStore()
@MainActor fileprivate static let _settingsStore = SettingsStore()
private static let _agentLaunchController = AgentLaunchController()
@Entry var agentLaunchController: any AgentLaunchControllerProtocol = _agentLaunchController
@@ -122,6 +128,10 @@ extension EnvironmentValues {
@MainActor var certificateStore: CertificateStore {
EnvironmentValues._certificateStore
}
@MainActor var settingsStore: SettingsStore {
EnvironmentValues._settingsStore
}
}
extension FocusedValues {

View File

@@ -0,0 +1,14 @@
import SwiftUI
import SettingsKit
struct SettingsView: View {
@Environment(\.settingsStore) var settingsStore
var body: some View {
Form {
}
.padding()
.frame(minWidth: 480, minHeight: 320)
}
}