Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sync keychain over iCloud

I wan't to store sensitive data for my app in the keychain. I'd also like this to sync over devices, using iCloud.

According to Apple this is possible:

Does iCloud Keychain work with third-party apps?

Yes. Developers can update their apps to work with iCloud Keychain. Passwords saved by those apps are kept up to date on all devices that use the app and are using iOS 7.0.3 or later or OS X Mavericks v10.9 or later.

However, I can't find any documentation about what is needed by the app. Will all content of the keychain be synced if the user has enabled iCloud Keychain?

like image 351
johan Avatar asked Nov 18 '15 08:11

johan


1 Answers

You need to set the kSecAttrSynchronizable attribute when adding any item that you want to be synced. I would suggest using a wrapper library such as KeychainAccess (in swift) or UICKeyChainStore (in Obj-C), as it largely facilitates the handling of the keychain and of the various attributes (they both provide a synchronizable property)

like image 158
spassas Avatar answered Oct 14 '22 04:10

spassas