jrendel / SwiftKeychainWrapper

A simple wrapper for the iOS Keychain to allow you to use it in a similar fashion to User Defaults. Written in Swift.
MIT License
1.59k stars 340 forks source link

Integrate SwiftyKeychainWrapper with KeychainItemWrapper #26

Closed ruipfcosta closed 8 years ago

ruipfcosta commented 9 years ago

In this app I'm working on we are using Apple's KeychainItemWrapper to interact with the keychain, but we would like to move from that implementation to SwiftKeychainWrapper. Is it possible to access the existing keychain data with SwiftKeychainWrapper?

jrendel commented 8 years ago

I've been meaning to look into this but haven't had time. My suggestion would be to check what is being used for the SecAttrService, SecAttrAccount, and SecAttrGeneric attributes by KeychainItemWrapper. My wrapper uses the bundle id for the SecAttrService value (unless you manually specify your own service name) and then takes your key for a value you want to save, UTF8 encodes it as NSData, and uses that as the value for SecAttrAccount and SecAttrGeneric. So they would need to match up for existing data to work.

In my wrapper you can set the Service name, so that is not an issue. But the other two attributes may be handled differently.

jrendel commented 8 years ago

Did you test integrating with this at all? Can we close this issue or did you need additional help?