Remove StorageKey
This commit is contained in:
parent
2e437dac91
commit
a216e3d435
@ -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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import LocalData
|
import LocalData
|
||||||
|
import SharedKit
|
||||||
|
|
||||||
/// Keys that demonstrate conditional migrations based on app version.
|
/// Keys that demonstrate conditional migrations based on app version.
|
||||||
extension StorageKey where Value == String {
|
extension StorageKey where Value == String {
|
||||||
@ -16,7 +17,7 @@ extension StorageKey where Value == String {
|
|||||||
|
|
||||||
nonisolated static let modernAppMode = StorageKey(
|
nonisolated static let modernAppMode = StorageKey(
|
||||||
name: "modern_app_mode",
|
name: "modern_app_mode",
|
||||||
domain: .keychain(service: "com.mbrucedogs.securestorage"),
|
domain: .keychain(service: StorageServiceIdentifiers.keychainLocation),
|
||||||
security: .keychain(
|
security: .keychain(
|
||||||
accessibility: .afterFirstUnlock,
|
accessibility: .afterFirstUnlock,
|
||||||
accessControl: .userPresence
|
accessControl: .userPresence
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import LocalData
|
import LocalData
|
||||||
|
import SharedKit
|
||||||
|
|
||||||
/// Keys that demonstrate a simple legacy-to-modern migration path.
|
/// Keys that demonstrate a simple legacy-to-modern migration path.
|
||||||
extension StorageKey where Value == String {
|
extension StorageKey where Value == String {
|
||||||
@ -18,7 +19,7 @@ extension StorageKey where Value == String {
|
|||||||
/// The modern key where data should end up (in Keychain).
|
/// The modern key where data should end up (in Keychain).
|
||||||
nonisolated static let modernMigrationDestination = StorageKey(
|
nonisolated static let modernMigrationDestination = StorageKey(
|
||||||
name: "secure_user_id",
|
name: "secure_user_id",
|
||||||
domain: .keychain(service: "com.mbrucedogs.securestorage"),
|
domain: .keychain(service: StorageServiceIdentifiers.keychainLocation),
|
||||||
security: .keychain(
|
security: .keychain(
|
||||||
accessibility: .afterFirstUnlock,
|
accessibility: .afterFirstUnlock,
|
||||||
accessControl: .userPresence
|
accessControl: .userPresence
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import LocalData
|
import LocalData
|
||||||
|
import SharedKit
|
||||||
|
|
||||||
/// Legacy string payload that will be transformed into a structured model.
|
/// Legacy string payload that will be transformed into a structured model.
|
||||||
extension StorageKey where Value == String {
|
extension StorageKey where Value == String {
|
||||||
@ -19,7 +20,7 @@ extension StorageKey where Value == String {
|
|||||||
extension StorageKey where Value == ProfileName {
|
extension StorageKey where Value == ProfileName {
|
||||||
nonisolated static let modernProfileName = StorageKey(
|
nonisolated static let modernProfileName = StorageKey(
|
||||||
name: "modern_profile_name",
|
name: "modern_profile_name",
|
||||||
domain: .keychain(service: "com.mbrucedogs.securestorage"),
|
domain: .keychain(service: StorageServiceIdentifiers.keychainLocation),
|
||||||
security: .keychain(
|
security: .keychain(
|
||||||
accessibility: .afterFirstUnlock,
|
accessibility: .afterFirstUnlock,
|
||||||
accessControl: .userPresence
|
accessControl: .userPresence
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user