Нет описания

Shazron Abdullah 57afa6e3f4 Updated example/ 12 лет назад
example 57afa6e3f4 Updated example/ 12 лет назад
src 104bc00060 Updated to use Cordova 2.2.0 and made it pluginstall-able 13 лет назад
www 0a835d738e Fixes #7 - Update plugin.xml for Cordova 3.0.0 12 лет назад
.gitignore 104bc00060 Updated to use Cordova 2.2.0 and made it pluginstall-able 13 лет назад
LICENSE 104bc00060 Updated to use Cordova 2.2.0 and made it pluginstall-able 13 лет назад
README.md 0a835d738e Fixes #7 - Update plugin.xml for Cordova 3.0.0 12 лет назад
plugin.xml 11aff59e0c Added license in plugin.xml 12 лет назад

README.md

Keychain Plugin for Apache Cordova

created by Shazron Abdullah

Apache 2.0 License except for the SFHFKeychainUtils code that is under src/ios/SFHFKeychainUtils

Follows the Cordova Plugin spec, so that it works with Plugman, or you can install it manually below.

Manually importing the plugin is not supported anymore, please use Plugman or the Cordova CLI tool

The "Keychain" object definition is installed globally.

The plugin's JavaScript functions are called after creating the plugin object thus:

    var kc = new Keychain();
    kc.getForKey(win, fail, "some_key", "some_servicename");

Important:

    If you are saving a JSON string value in setForKey, for example after applying JSON.stringify on an object, you must escape the characters in that string, if not you cannot retrieve it using getForKey.        

    var obj = { foo: 'bar' };
    var value = JSON.stringify(obj);
    value = value 
          .replace(/[\\]/g, '\\\\')
          .replace(/[\"]/g, '\\\"')
          .replace(/[\/]/g, '\\/')
          .replace(/[\b]/g, '\\b')
          .replace(/[\f]/g, '\\f')
          .replace(/[\n]/g, '\\n')
          .replace(/[\r]/g, '\\r')
          .replace(/[\t]/g, '\\t');

See the example folder for example usage.

    // Get a reference to the plugin first
    var kc = new Keychain();

    /*
     Retrieves a value for a key and servicename.

     @param successCallback returns the value as the argument to the callback when successful
     @param failureCallback returns the error string as the argument to the callback, for a failure
     @param key the key to retrieve
     @param servicename the servicename to use
     */
    kc.getForKey(successCallback, failureCallback, 'key', 'servicename');

    /*
     Sets a value for a key and servicename.

     @param successCallback returns when successful
     @param failureCallback returns the error string as the argument to the callback, for a failure
     @param key the key to set
     @param servicename the servicename to use
     @param value the value to set
     */
    kc.setForKey(successCallback, failureCallback, 'key', 'servicename', 'value');

    /*
     Removes a value for a key and servicename.

     @param successCallback returns when successful
     @param failureCallback returns the error string as the argument to the callback
     @param key the key to remove
     @param servicename the servicename to use
     */
    kc.removeForKey(successCallback, failureCallback, 'key', 'servicename');