Shazron's Cordova (aka PhoneGap) Blog

at Adobe Systems Inc.

iOS Keychain Plugin for PhoneGap

with 7 comments

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

 

keychain.jpg

 

Written by shazron

November 6, 2010 at 1:56 am

Posted in phonegap

7 Responses

Subscribe to comments with RSS.

  1. Very cool!

    “should be self-explanatory.” Let’s see how many support posts this generates …

    Nick

    November 6, 2010 at 12:42 pm

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

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

  4. Great. Is there also an equivalent for Android platforms? Compatibility with PG 1.4 ?

    tribalvibes1bes

    February 2, 2012 at 11:52 pm

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

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


Leave a comment