diff --git a/README.md b/README.md index 5628e55..cd03179 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/SecureStorgageSample/Models/AppGroupConfiguration.swift b/SecureStorgageSample/Models/AppGroupConfiguration.swift deleted file mode 100644 index 4ec4ad5..0000000 --- a/SecureStorgageSample/Models/AppGroupConfiguration.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import SharedKit - -enum AppGroupConfiguration { - static var identifier: String { - StorageServiceIdentifiers.appGroupIdentifier - } -} diff --git a/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserDefaultsKey.swift b/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserDefaultsKey.swift index de15c57..93e0a13 100644 --- a/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserDefaultsKey.swift +++ b/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserDefaultsKey.swift @@ -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 = .json let owner = "SampleApp" diff --git a/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserProfileKey.swift b/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserProfileKey.swift index 8ade156..ebca327 100644 --- a/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserProfileKey.swift +++ b/SecureStorgageSample/StorageKeys/AppGroup/AppGroupUserProfileKey.swift @@ -24,7 +24,7 @@ extension StorageKeys { } var domain: StorageDomain { - .appGroupFileSystem(identifier: AppGroupConfiguration.identifier, directory: directory) + .appGroupFileSystem(identifier: StorageServiceIdentifiers.appGroupIdentifier, directory: directory) } } } diff --git a/SecureStorgageSample/StorageKeys/AppGroup/UserPreferencesKey.swift b/SecureStorgageSample/StorageKeys/AppGroup/UserPreferencesKey.swift index ec216bd..b36c426 100644 --- a/SecureStorgageSample/StorageKeys/AppGroup/UserPreferencesKey.swift +++ b/SecureStorgageSample/StorageKeys/AppGroup/UserPreferencesKey.swift @@ -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"