From 0b6cbd4f7b8fcbf7123b220d2d3c5d021f7277c0 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Mon, 25 May 2020 10:15:54 -0700 Subject: [PATCH 1/3] Use correct Valet name in README example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e46cfc1..de4a553a 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ The identifier you choose for your Valet is used to create a sandbox for the dat #### Choosing a User-friendly Identifier on macOS ```swift -let mySecureEnclaveValet = Valet.valet(withExplicitlySet: Identifier(nonEmpty: "Druidia")!, accessibility: .whenUnlocked) +let myValet = Valet.valet(withExplicitlySet: Identifier(nonEmpty: "Druidia")!, accessibility: .whenUnlocked) ``` ```objc From 48d89fb66bba2f6fd0146d00a2a3224a4141aeb7 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Mon, 25 May 2020 10:16:06 -0700 Subject: [PATCH 2/3] Create Changing an Accessibility Value After Persisting Data section --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index de4a553a..2735b24e 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,22 @@ Mac apps signed with a developer ID may see their Valet’s identifier [shown to The Accessibility enum is used to determine when your secrets can be accessed. It’s a good idea to use the strictest accessibility possible that will allow your app to function. For example, if your app does not run in the background you will want to ensure the secrets can only be read when the phone is unlocked by using `.whenUnlocked` or `.whenUnlockedThisDeviceOnly`. +#### Changing an Accessibility Value After Persisting Data + +```swift +let myOldValet = Valet.valet(withExplicitlySet: Identifier(nonEmpty: "Druidia")!, accessibility: .whenUnlocked) +let myNewValet = Valet.valet(withExplicitlySet: Identifier(nonEmpty: "Druidia")!, accessibility: .afterFirstUnlock) +try? myNewValet.migrateObjects(from: myOldValet, removeOnCompletion: true) +``` + +```objc +VALValet *const myOldValet = [VALValet valetWithExplicitlySetIdentifier:@"Druidia" accessibility:VALAccessibilityWhenUnlocked]; +VALValet *const myNewValet = [VALValet valetWithExplicitlySetIdentifier:@"Druidia" accessibility:VALAccessibilityAfterFirstUnlock]; +[myNewValet migrateObjectsFrom:myOldValet removeOnCompletion:true error:nil]; +``` + +The Valet type, identifier, accessibility value, and initializer chosen to create a Valet are combined to create a sandbox within the keychain. This behavior ensures that different Valets can not read or write one another's key:value pairs. If you change a Valet's accessibility after persisting key:value pairs, you must migrate the key:values pairs from the Valet with the no-longer-desired accessibility to the Valet with the desired accessibility to avoid data loss. + ### Reading and Writing ```swift From f3ce0ae1affbae4b8bfab8127266bfeb7d373f16 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Mon, 25 May 2020 16:28:31 -0700 Subject: [PATCH 3/3] fix typo Co-authored-by: Nick Entin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2735b24e..1e766cc0 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ VALValet *const myNewValet = [VALValet valetWithExplicitlySetIdentifier:@"Druidi [myNewValet migrateObjectsFrom:myOldValet removeOnCompletion:true error:nil]; ``` -The Valet type, identifier, accessibility value, and initializer chosen to create a Valet are combined to create a sandbox within the keychain. This behavior ensures that different Valets can not read or write one another's key:value pairs. If you change a Valet's accessibility after persisting key:value pairs, you must migrate the key:values pairs from the Valet with the no-longer-desired accessibility to the Valet with the desired accessibility to avoid data loss. +The Valet type, identifier, accessibility value, and initializer chosen to create a Valet are combined to create a sandbox within the keychain. This behavior ensures that different Valets can not read or write one another's key:value pairs. If you change a Valet's accessibility after persisting key:value pairs, you must migrate the key:value pairs from the Valet with the no-longer-desired accessibility to the Valet with the desired accessibility to avoid data loss. ### Reading and Writing