Update SecureStorageSample

This commit is contained in:
Matt Bruce 2026-01-17 12:33:50 -06:00
parent a216e3d435
commit 5be1080e08
5 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,8 @@ extension StorageKey where Value == UserProfile {
) )
/// Creates a version of the key for a different App Group directory. /// Creates a version of the key for a different App Group directory.
/// Sample-only: production apps should avoid dynamic App Group configuration and
/// migrate when storage settings change.
nonisolated static func appGroupUserProfileKey( nonisolated static func appGroupUserProfileKey(
directory: FileDirectory = .documents directory: FileDirectory = .documents
) -> StorageKey { ) -> StorageKey {

View File

@ -17,6 +17,8 @@ extension StorageKey where Value == [String] {
) )
/// Builds a variant with a custom PBKDF2 iteration count for demo purposes. /// Builds a variant with a custom PBKDF2 iteration count for demo purposes.
/// Sample-only: production apps should treat encryption parameters as fixed and
/// perform a migration if they must change.
nonisolated static func sessionLogsKey(iterations: Int) -> StorageKey { nonisolated static func sessionLogsKey(iterations: Int) -> StorageKey {
StorageKey( StorageKey(
name: "session_logs.json", name: "session_logs.json",

View File

@ -17,6 +17,8 @@ extension StorageKey where Value == UserProfile {
) )
/// Builds a profile key for an alternate file directory. /// Builds a profile key for an alternate file directory.
/// Sample-only: production apps should keep directory decisions static; if the
/// storage domain changes, migrate instead of toggling the key at runtime.
nonisolated static func userProfileFileKey(directory: FileDirectory = .documents) -> StorageKey { nonisolated static func userProfileFileKey(directory: FileDirectory = .documents) -> StorageKey {
StorageKey( StorageKey(
name: UserProfile.storageKeyName, name: UserProfile.storageKeyName,

View File

@ -18,6 +18,8 @@ extension StorageKey where Value == Credential {
) )
/// Builds a key with custom Keychain accessibility or access control options. /// Builds a key with custom Keychain accessibility or access control options.
/// Sample-only: production apps should not allow dynamic key configuration; treat
/// StorageKey settings as fixed and migrate if security policies change.
nonisolated static func credentialsKey( nonisolated static func credentialsKey(
accessibility: KeychainAccessibility = .afterFirstUnlock, accessibility: KeychainAccessibility = .afterFirstUnlock,
accessControl: KeychainAccessControl? = nil accessControl: KeychainAccessControl? = nil

View File

@ -17,6 +17,8 @@ extension StorageKey where Value == String {
) )
/// Builds a variant to demonstrate different availability and sync policies. /// Builds a variant to demonstrate different availability and sync policies.
/// Sample-only: production apps should keep availability and sync policies static;
/// if these change, migrate the data rather than altering the key at runtime.
nonisolated static func syncableSettingKey( nonisolated static func syncableSettingKey(
availability: PlatformAvailability = .all, availability: PlatformAvailability = .all,
syncPolicy: SyncPolicy = .never syncPolicy: SyncPolicy = .never