cordova-plugin-ios-keychain icon indicating copy to clipboard operation
cordova-plugin-ios-keychain copied to clipboard

iOS Keychain Sharing

Open coreykouns opened this issue 7 years ago • 18 comments

Hello developers!

Thank you very much for implementing this plugin. It is very easy to use and has a clean, simple implementation. However, my team is hoping to use this plugin in order to access a shared Keychain across multiple apps for our company, and are struggling to come up with a solution.

We have been unable to find a way to specify an accessGroup within your plugin, even after modification of the .m files within src/ios. On two separate apps, we have enabled Keychain Sharing through XCode, given them both the same Keychain Group name within their .entitlements files, and also enabled iCloud for good measure through our Apple Developer site. They both use the same Bundle Seed as well.

Would you be able to shed any light on how we might implement Keychain Sharing using your plugin? Any help or suggestions would be greatly appreciated.

coreykouns avatar Mar 10 '17 13:03 coreykouns

I think for now you can prefix bundle identifier in all your keys to uniquely identify between your multiple apps.

rahulvyas avatar May 02 '17 07:05 rahulvyas

Hi Team

I want to thank you too, I'm very noob in Ionic and Cordova and this kind of plugins make my life easier. XD Also I have the same doubt. So did you mean that I could get a key by passing AppIdPrefix.KeychainGroup@mykey in the corresponding method or something similar?

Thanks again

marcRDZ avatar May 11 '17 15:05 marcRDZ

Did you get key sharing to work on ionic apps

rs743 avatar May 24 '17 13:05 rs743

@coreykouns Did you find any solution?

hassanShahzad avatar Jul 07 '17 12:07 hassanShahzad

Hi there, I was wondering if you managed to make this work because I am in the same boat as you. I really need to transfer some account info to my extension and keychain sharing seems to be the best option.

Cakaaa avatar Mar 27 '18 14:03 Cakaaa

Hi, I had to develop a plugin exposing that feature while I was waiting a reply here. https://www.npmjs.com/package/cordova-plugin-fdkeychain Hope this can help someone

marcRDZ avatar Mar 27 '18 16:03 marcRDZ

We ended up replacing the ObjC code with a swift implementation to solve the problem

Sent from Outlookhttps://aka.ms/qtex0l for iPhone


From: marcRDZ [email protected] Sent: Tuesday, March 27, 2018 12:46:08 PM To: ionic-team/cordova-plugin-ios-keychain Cc: Jeremy Keczan; Manual Subject: Re: [ionic-team/cordova-plugin-ios-keychain] iOS Keychain Sharing (#18)

Hi, I had to develop a plugin exposing that feature while I was waiting a reply here. https://www.npmjs.com/package/cordova-plugin-fdkeychainhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fcordova-plugin-fdkeychain&data=02%7C01%7C%7C30d64f07bccf4678d58208d594023de7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636577659700243680&sdata=413ayxbyL9ON6rK%2BBp3VtsaM%2F%2B9M15%2BtxTwvmv6GxG0%3D&reserved=0 Hope this can help someone

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fionic-team%2Fcordova-plugin-ios-keychain%2Fissues%2F18%23issuecomment-376594487&data=02%7C01%7C%7C30d64f07bccf4678d58208d594023de7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636577659700243680&sdata=%2B4OkkVGTML40a78%2FPAXAqgRD7nLkfF%2BGTA1vl0VyUmk%3D&reserved=0, or mute the threadhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAALyav1hrRMF_GJ6U0-mokVyJDyDCVNoks5timzQgaJpZM4MZYPd&data=02%7C01%7C%7C30d64f07bccf4678d58208d594023de7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636577659700243680&sdata=72fHd0%2FK10JpjusIpT%2BFCATtCF1Sow4HIjmd6ndwm8U%3D&reserved=0.

jkeczan avatar Mar 27 '18 16:03 jkeczan

Thnx for the response guys. I also found this: https://plugins.telerik.com/cordova/plugin/keychain-sharing. Gonna have to check if it works. If it doesnt ill be trying your plugin @marcRDZ

Cakaaa avatar Mar 27 '18 17:03 Cakaaa

I was able to make this work by using secure storage plugin. You also need to turn on Keychain sharing capability for the app.

On Tue, Mar 27, 2018 at 10:41 AM, Cakaaa [email protected] wrote:

Hi there, I was wondering if you managed to make this work because I am in the same boat as you. I really need to transfer some account info to my extension and keychain sharing seems to be the best option.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ionic-team/cordova-plugin-ios-keychain/issues/18#issuecomment-376550568, or mute the thread https://github.com/notifications/unsubscribe-auth/AE4ihBC5FoR4ytoZKPdd7b-2rwgPtD09ks5tik-GgaJpZM4MZYPd .

rs743 avatar Mar 27 '18 17:03 rs743

@rs743 This one you mean https://github.com/Crypho/cordova-plugin-secure-storage ? How did you connect the Keychain sharing capability because i dont see anything about that capability in the docs of that plugin. Reading the ios docs, i am assuming you applied the correct attributes to the keys inside the keychain, is that correct? It says right here that attributes can define how data is shared.

In addition to the data that you want to store, keychain items also have attributes that allow you to find them later and that allow you to control how the data is used or shared.

from the docs: https://developer.apple.com/documentation/security/keychain_services/keychain_items/item_attribute_keys_and_values

Cakaaa avatar Mar 27 '18 17:03 Cakaaa

@jkeczan It seems that ill have a few options without implementing it myself ^^

Cakaaa avatar Mar 27 '18 17:03 Cakaaa

use the plugin https://ionicframework.com/docs/native/secure-storage/ create secure storage with the same name you are using when enabling keychain sharing capability using xcode

On Tue, Mar 27, 2018 at 1:35 PM, Cakaaa [email protected] wrote:

@rs743 https://github.com/rs743 This one you mean https://github.com/Crypho/cordova-plugin-secure-storage ? How did you connect the Keychain sharing capability because i dont see anything about that capability in the docs of that plugin. Reading the ios docs, i am assuming you applied the correct attributes to the keys inside the keychain, is that correct? It says right here that attributes can define how data is shared.

In addition to the data that you want to store, keychain items also have attributes that allow you to find them later and that allow you to control how the data is used or shared.

from the docs: https://developer.apple.com/documentation/security/ keychain_services/keychain_items/item_attribute_keys_and_values

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ionic-team/cordova-plugin-ios-keychain/issues/18#issuecomment-376610423, or mute the thread https://github.com/notifications/unsubscribe-auth/AE4ihKY4itfeef1Rd9obgJ1HjEaJEY5Wks5tinhMgaJpZM4MZYPd .

rs743 avatar Mar 27 '18 19:03 rs743

@rs743 Thanks for the info. Much apreciated! :D

Cakaaa avatar Mar 27 '18 19:03 Cakaaa

@rs743 None of the callbacks are triggered. I have enabled Keychain sharing and used that as the initializer for the constructor

var ss = new cordova.plugins.SecureStorage( function () { console.log('Success')}, function (error) { console.log('Error ' + error); }, 'my_shared_keychain_string');

I have also tried using just a random string but none of it works.

Did you by any chance experience the same issue?

Cakaaa avatar Mar 28 '18 10:03 Cakaaa

Also have same issue as @Cakaaa, none of my callbacks are triggered

johnopaluwa avatar Apr 12 '18 08:04 johnopaluwa

@johnopaluwa My problem was this piece of code in my index.html. For some reason, it blocked some of my plugins. When i removed it, everything just started working.

<meta http-equiv="Content-Security-Policy" content="default-src * mydefaultsrc:; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';">

Cakaaa avatar Apr 12 '18 09:04 Cakaaa

@Cakaaa thanks for the information

johnopaluwa avatar Apr 12 '18 11:04 johnopaluwa

I've added the Keychain Sharing capabilities to this plugin. (You can't use Ionic typescript bridge for this)

My fork. https://github.com/yj-ang/cordova-plugin-ios-keychain

yj-ang avatar Jun 18 '19 03:06 yj-ang