ionic-team / cordova-plugin-ios-keychain

Apache Cordova (PhoneGap) plugin
Other
62 stars 44 forks source link

iOS Keychain Sharing #18

Open coreykouns opened 7 years ago

coreykouns commented 7 years ago

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.

rahulvyas commented 7 years ago

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

marcRDZ commented 7 years ago

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

rs743 commented 7 years ago

Did you get key sharing to work on ionic apps

hassanShahzad commented 7 years ago

@coreykouns Did you find any solution?

Cakaaa commented 6 years ago

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.

marcRDZ commented 6 years ago

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

jkeczan commented 6 years ago

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 notifications@github.com 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.

Cakaaa commented 6 years ago

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

rs743 commented 6 years ago

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 notifications@github.com 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 .

Cakaaa commented 6 years ago

@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 commented 6 years ago

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

rs743 commented 6 years ago

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 notifications@github.com 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 .

Cakaaa commented 6 years ago

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

Cakaaa commented 6 years ago

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

johnopaluwa commented 6 years ago

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

Cakaaa commented 6 years ago

@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';">

johnopaluwa commented 6 years ago

@Cakaaa thanks for the information

yj-ang commented 5 years ago

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