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.




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 …


    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.



    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.



    November 16, 2011 at 2:37 pm

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


    February 2, 2012 at 11:52 pm

  5. Shazron,

    Thank you for updating the plugin to support Cordova (1.6+):

    Works like a charm.

    Much appreciate it,



    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.

    var temp = window.plugins.keychain.getForKey(key, servicename, win, fail);
    return temp;



    October 27, 2012 at 11:25 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 1,757 other followers

%d bloggers like this: