square / Valet

Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy. We promise.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find object after switching accessibility

macrossyun opened this issue · comments

Recently we changed the accessibility from .whenUnlockedThisDeviceOnly to .afterFirstUnlockThisDeviceOnly, and it is causing the object we stored in the keychain can not be found after users update the app.

We stored the id token in the keychain, and it force the users to log out the app. However after they login back, the problem just doesn't happen anymore.

The version of Valet we are using is 3.2.5

Thanks for the report @macrossyun!

Can you help me understand the steps you took? It sounds like you changed the accessibility on your Valet, but did you migrate the values from the old Valet configuration to the new Valet configuration using the migrateObjects(from:removeOnCompletion:) method?

Our README states that:

Valets created with a different class type, via a different initializer, or with a different accessibility attribute will not be able to read or modify values in myValet.

If you didn’t migrate after changing accessibility values, please let me know. I can re-task this issue to track making an explicit section in the README on “Changing your Accessibility value” to try to make this workflow more clear.

Thanks for your reply @dfed. Yeah, I think that must be the reason, I didn't notice that line in README when I changed the accessibility. As I used to use other library before with similar setting, I thought it wouldn't be the problem when change the accessibility........

Sorry my bad

Thanks for letting me know! I’ll update the README to make this more clear.

Thanks @dfed !