Add AppStorageCatalog

This commit is contained in:
Matt Bruce 2026-01-14 10:24:11 -06:00
parent e7115693a1
commit 92adb96fe1
3 changed files with 33 additions and 0 deletions

View File

@ -112,6 +112,7 @@ The app demonstrates various storage configurations:
- Storage keys are now split into one file per key and grouped by domain; platform-focused keys live in `StorageKeys/Platform` with comments calling out availability/sync focus.
- The shared model/constants live in `SharedPackage` (`SharedKit`) to keep the watch/iOS data contract centralized.
- The watch app uses a handler-based WatchConnectivity layer so new payload types can be added in `Services/Handlers` without bloating the main service.
- A `StorageKeyCatalog` sample is included to generate a security audit report of all storage keys.
## License

View File

@ -18,6 +18,10 @@ struct SecureStorgageSampleApp: App {
for: SampleKeyMaterialSources.external
)
}
#if DEBUG
let report = StorageAuditReport.renderText(for: AppStorageCatalog.self)
print(report)
#endif
}
var body: some Scene {

View File

@ -0,0 +1,28 @@
import Foundation
import LocalData
import SharedKit
struct AppStorageCatalog: StorageKeyCatalog {
static var allKeys: [StorageKeyDescriptor] {
[
.from(StorageKeys.AppVersionKey(), serializer: "json"),
.from(StorageKeys.UserPreferencesKey(), serializer: "json"),
.from(StorageKeys.CredentialsKey(), serializer: "json"),
.from(StorageKeys.LastLocationKey(), serializer: "json"),
.from(StorageKeys.APITokenKey(), serializer: "json"),
.from(StorageKeys.UserProfileFileKey(), serializer: "json"),
.from(StorageKeys.CachedDataKey(), serializer: "data"),
.from(StorageKeys.SettingsPlistKey(), serializer: "plist"),
.from(StorageKeys.SessionLogsKey(), serializer: "json"),
.from(StorageKeys.PrivateNotesKey(), serializer: "json"),
.from(StorageKeys.ExternalSessionLogsKey(), serializer: "json"),
.from(StorageKeys.WatchVibrationKey(), serializer: "json"),
.from(StorageKeys.SyncableSettingKey(), serializer: "json"),
.from(
StorageKeys.ExternalKeyMaterialKey(keyName: "<dynamic>"),
serializer: "data",
notes: "Key name is dynamic per external source."
)
]
}
}