From a216e3d435614bb22d1cd5844cd5a0a63c26a7a5 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sat, 17 Jan 2026 12:29:30 -0600 Subject: [PATCH] Remove StorageKey --- .../FileSystem/CustomEncodedKey.swift | 28 ------------------- .../Migration/ConditionalMigrationKeys.swift | 3 +- .../StorageKeys/Migration/MigrationKeys.swift | 3 +- .../Migration/TransformingMigrationKeys.swift | 3 +- 4 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 SecureStorageSample/StorageKeys/FileSystem/CustomEncodedKey.swift diff --git a/SecureStorageSample/StorageKeys/FileSystem/CustomEncodedKey.swift b/SecureStorageSample/StorageKeys/FileSystem/CustomEncodedKey.swift deleted file mode 100644 index db7bc55..0000000 --- a/SecureStorageSample/StorageKeys/FileSystem/CustomEncodedKey.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import LocalData - -/// File system key that demonstrates custom serializer usage. -extension StorageKey where Value == String { - /// Example using custom serializer for specialized encoding. - nonisolated static let customEncoded = StorageKey( - name: "custom_encoded", - domain: .fileSystem(directory: .documents), - security: .none, - serializer: .custom( - encode: { value in - Data(value.utf8).base64EncodedData() - }, - decode: { data in - guard let decoded = Data(base64Encoded: data), - let string = String(data: decoded, encoding: .utf8) else { - throw StorageError.deserializationFailed - } - return string - } - ), - owner: "SampleApp", - description: "Stores custom-encoded string data (Base64 example).", - availability: .all, - syncPolicy: .never - ) -} diff --git a/SecureStorageSample/StorageKeys/Migration/ConditionalMigrationKeys.swift b/SecureStorageSample/StorageKeys/Migration/ConditionalMigrationKeys.swift index 0e6931c..39d494f 100644 --- a/SecureStorageSample/StorageKeys/Migration/ConditionalMigrationKeys.swift +++ b/SecureStorageSample/StorageKeys/Migration/ConditionalMigrationKeys.swift @@ -1,5 +1,6 @@ import Foundation import LocalData +import SharedKit /// Keys that demonstrate conditional migrations based on app version. extension StorageKey where Value == String { @@ -16,7 +17,7 @@ extension StorageKey where Value == String { nonisolated static let modernAppMode = StorageKey( name: "modern_app_mode", - domain: .keychain(service: "com.mbrucedogs.securestorage"), + domain: .keychain(service: StorageServiceIdentifiers.keychainLocation), security: .keychain( accessibility: .afterFirstUnlock, accessControl: .userPresence diff --git a/SecureStorageSample/StorageKeys/Migration/MigrationKeys.swift b/SecureStorageSample/StorageKeys/Migration/MigrationKeys.swift index 2c18dd6..936a241 100644 --- a/SecureStorageSample/StorageKeys/Migration/MigrationKeys.swift +++ b/SecureStorageSample/StorageKeys/Migration/MigrationKeys.swift @@ -1,5 +1,6 @@ import Foundation import LocalData +import SharedKit /// Keys that demonstrate a simple legacy-to-modern migration path. extension StorageKey where Value == String { @@ -18,7 +19,7 @@ extension StorageKey where Value == String { /// The modern key where data should end up (in Keychain). nonisolated static let modernMigrationDestination = StorageKey( name: "secure_user_id", - domain: .keychain(service: "com.mbrucedogs.securestorage"), + domain: .keychain(service: StorageServiceIdentifiers.keychainLocation), security: .keychain( accessibility: .afterFirstUnlock, accessControl: .userPresence diff --git a/SecureStorageSample/StorageKeys/Migration/TransformingMigrationKeys.swift b/SecureStorageSample/StorageKeys/Migration/TransformingMigrationKeys.swift index d342eb6..5317b4a 100644 --- a/SecureStorageSample/StorageKeys/Migration/TransformingMigrationKeys.swift +++ b/SecureStorageSample/StorageKeys/Migration/TransformingMigrationKeys.swift @@ -1,5 +1,6 @@ import Foundation import LocalData +import SharedKit /// Legacy string payload that will be transformed into a structured model. extension StorageKey where Value == String { @@ -19,7 +20,7 @@ extension StorageKey where Value == String { extension StorageKey where Value == ProfileName { nonisolated static let modernProfileName = StorageKey( name: "modern_profile_name", - domain: .keychain(service: "com.mbrucedogs.securestorage"), + domain: .keychain(service: StorageServiceIdentifiers.keychainLocation), security: .keychain( accessibility: .afterFirstUnlock, accessControl: .userPresence