Remove StorageKey

This commit is contained in:
Matt Bruce 2026-01-17 12:29:30 -06:00
parent 2e437dac91
commit a216e3d435
4 changed files with 6 additions and 31 deletions

View File

@ -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
)
}

View File

@ -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

View File

@ -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

View File

@ -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