Open igorkulman opened 5 years ago
This is very interesting, @igorkulman, thanks for reporting!
It looks like after the key is assigned to an access group it will then be treated as a shared key, even if you don't specify the access group. Consequently, it seems to be impossible to move a key to another app. We can only copy a key, but not move it.
Let me know if you find a workaround.
In my specific case, the workaround is quite simple
for key in keys {
if let value = oldKeyChain.get(key) {
oldKeyChain.delete(key)
keychain.set(value, forKey: key, withAccess: .accessibleAfterFirstUnlockThisDeviceOnly)
}
}
I have the value in a local variable so I can delete it first from the old keychain and then write it to the new one.
I have a "normal" keychain and I need data from it migrated to a shared keychain. The shared keychain is already set up and working properly, I just need to move some old data to it because of a new feature.
I use code like this to do the migration
The problem is that
keychain.set
saves the value to the shared keychain butoldKeyChain.delete
deletes it not only from the old keychain but also from the shared one.This is visible adding some print statements
Results in