iOS Keychain Plugin for PhoneGap
[UPDATE] Updated for Cordova.
So what is the Keychain? It’s a framework to store data (particularly passwords) securely on Mac OS X and iOS. You really don’t want to store passwords and other sensitive information in HTML5 local or web storage. This is a PhoneGap plugin for iOS that provides access to the Keychain through Javascript. Based on Buzz Andersen’s work – namely SFHFKeychainUtils
View the README and check out the sample app’s index.html for usage. Play around with the Get, Set, and Remove examples, should be self-explanatory.
Very cool!
“should be self-explanatory.” Let’s see how many support posts this generates …
Nick
November 6, 2010 at 12:42 pm
I am having zero luck with this with XCode 4.2 and Phonegap 1.1. I put a breakpoint in set initWithWebView and setForKey and getting no breaks. Is there some other step other than copying the m and h files into plugins and including the js and your index.html in a blank project? Any help would be appreciated.
–Greg
Greg
November 16, 2011 at 2:20 pm
Update: You have to add an entry to your phonegap.plist, add a plugin entry with the key of “SAiOSKeychainPlugin” and the value of “SAiOSKeychainPlugin” and it will start to work. The example on github will not work because these are missing. Seems to be a cut and paste issue with the paypal plugin.
–Greg
Greg
November 16, 2011 at 2:37 pm
Great. Is there also an equivalent for Android platforms? Compatibility with PG 1.4 ?
tribalvibes1bes
February 2, 2012 at 11:52 pm
Shazron,
Thank you for updating the plugin to support Cordova (1.6+):
https://github.com/phonegap/phonegap-plugins/tree/master/iOS/Keychain
Works like a charm.
Much appreciate it,
Patrick
patrick
July 9, 2012 at 6:56 pm
How can I return the password in the onGet() function? Right now it is just popping up. But when I call the function somewhere else I need the password.
Like
var temp = window.plugins.keychain.getForKey(key, servicename, win, fail);
return temp;
Thanks!
Gunnar
October 27, 2012 at 11:25 pm
The value is passed to the callback function as described here: https://github.com/phonegap/phonegap-plugins/blob/master/iOS/Keychain/index.html#L51
It is an asynchronous API (value returned in a callback) not synchronous as you expect.
shazron
October 30, 2012 at 10:54 pm