oblador / react-native-keychain

:key: Keychain Access for React Native
MIT License
3.16k stars 520 forks source link

Cannot see my keychain in iCloud #156

Open RoMay opened 5 years ago

RoMay commented 5 years ago

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.

RoMay commented 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.

msiryk commented 5 years ago

I have the same problem. Is it possible to do something img_2102 like that (screenshot)?

hellogerard commented 5 years ago

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?

hellogerard commented 5 years ago

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.

hellogerard commented 4 years ago

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).

taschik commented 4 years ago

@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!

mrousavy commented 2 years ago

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?

sopianguyen commented 2 years ago

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