Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2026-01-14 12:18:33 -06:00
parent f2219e9df8
commit 1a71670f9d
5 changed files with 9 additions and 14 deletions

View File

@ -27,7 +27,7 @@ The project also includes a watchOS companion app target for watch-specific demo
1. Open `SecureStorgageSample.xcodeproj`
2. Select an iOS simulator or device
3. Build and run (⌘R)
4. To use App Group demos, set your App Group identifier in `SecureStorgageSample/SecureStorgageSample/Models/AppGroupConfiguration.swift` and enable the entitlement for each target that should share data.
4. To use App Group demos, enable the App Group entitlement for each target that should share data. The identifier is derived from the bundle ID via SharedKit constants.
## Project Structure
@ -37,7 +37,8 @@ SharedPackage/
└── Sources/
└── SharedKit/
├── Constants/
│ └── StorageKeyNames.swift
│ ├── StorageKeyNames.swift
│ └── StorageServiceIdentifiers.swift
└── Models/
└── UserProfile.swift
SecureStorgageSample/
@ -117,6 +118,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.
- Keychain service IDs and App Group identifiers are centralized in `SharedKit/Constants/StorageServiceIdentifiers.swift` to avoid hardcoded strings in keys.
- 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.
- Each `StorageKey` includes a `description` used in audit reports.

View File

@ -1,8 +0,0 @@
import Foundation
import SharedKit
enum AppGroupConfiguration {
static var identifier: String {
StorageServiceIdentifiers.appGroupIdentifier
}
}

View File

@ -1,6 +1,6 @@
import Foundation
import LocalData
import SharedKit
extension StorageKeys {
/// Stores a shared setting in App Group UserDefaults.
/// - Domain: App Group UserDefaults
@ -10,7 +10,7 @@ extension StorageKeys {
typealias Value = String
let name = "app_group_setting"
let domain: StorageDomain = .appGroupUserDefaults(identifier: AppGroupConfiguration.identifier)
let domain: StorageDomain = .appGroupUserDefaults(identifier: StorageServiceIdentifiers.appGroupIdentifier)
let security: SecurityPolicy = .none
let serializer: Serializer<String> = .json
let owner = "SampleApp"

View File

@ -24,7 +24,7 @@ extension StorageKeys {
}
var domain: StorageDomain {
.appGroupFileSystem(identifier: AppGroupConfiguration.identifier, directory: directory)
.appGroupFileSystem(identifier: StorageServiceIdentifiers.appGroupIdentifier, directory: directory)
}
}
}

View File

@ -1,5 +1,6 @@
import Foundation
import LocalData
import SharedKit
extension StorageKeys {
/// Stores user preferences in App Group UserDefaults.
@ -10,7 +11,7 @@ extension StorageKeys {
typealias Value = [String: AnyCodable]
let name = "user_preferences"
let domain: StorageDomain = .appGroupUserDefaults(identifier: AppGroupConfiguration.identifier)
let domain: StorageDomain = .appGroupUserDefaults(identifier: StorageServiceIdentifiers.appGroupIdentifier)
let security: SecurityPolicy = .none
let serializer: Serializer<[String: AnyCodable]> = .json
let owner = "SampleApp"