Open RoMay opened 5 years ago
Still trying to figure out how to synchronise the keys with iCloud.
@oblador @vonovak @pcoltau is it supported by the library at all? I would really appreciate any advice here.
I have the same problem. Is it possible to do something like that (screenshot)?
Same question. I would expect that setting a generic password or internet credentials would save to keychain, sync to iCloud, then show up in Keychain Access. But it does not. What am I missing?
Figured it out. Any keychain operations require the kSecAttrSynchronizable
attribute to be true to operate on an iCloud-synced entry. Here is the line I had to add everywhere:
(__bridge NSString *)kSecAttrSynchronizable: (__bridge id)(kCFBooleanTrue),
Here is the relevant Apple Dev doc on adding a password keychain entry.
I have a fork which adds a synchronized
option to all the methods. Keep in mind that you have to have this option on all function calls which might operate on an entry. That is, if you create an entry using synchronized
, you have to remove the entry with synchronized
set. I take no responsibility for this work, so use at your own risk. This commit has all the changes.
https://github.com/hellogerard/react-native-keychain/commit/e2959befa79d9e02513bb60bbafc9a1f2b32acb4
Once you have a Keychain entry syncing, you can see it the Keychain Access app for Mac OS (assuming you have iCloud Keychain enabled on your phone and the same Apple ID, etc, etc).
@hellogerard thanks for finding out, however I can't get it to work for me. Every time I call it like this:
const { email, password } = this.props
const synchronized = true
await Keychain.setGenericPassword(email, password, {
accessControl,
accessible,
synchronized,
})
I get : Error: One or more parameters passed to a function where not valid.
I used your fork to install the package. do you see the modal popping up as in your screenshot now, or do you have to build this yourself and just save it in the background. I try to achieve the same and would love to understand what the best practice for this is. Thanks so much in advance!
I'm in the same situation. I'm trying to securely store a password for an app in iCloud, so that the user can login when he switches phones.
Has anyone here achieved this?
Likewise. We are thinking of using this library for a feature we hope to build soon, but the difficulty in syncing the saved-keychain credentials with iCloud is a hinderance. It seems this PR will resolve it, but it needs a review and clarification from @oblador when he has time? 🙏 https://github.com/oblador/react-native-keychain/pull/497
All seems to work as expected. My question is: Is there a way to see the generated keychain, perhaps via Keychain Access.app or in iCloud?
Thanks for any suggestion.