Code Monkey home page Code Monkey logo

cordova-plugin-secure-key-store's Introduction

cordova-plugin-secure-key-store

Cordova plugin for securely saving keys, passwords or strings on devices.

Installation

The plugin can be installed via the Cordova command line interface:

cordova plugin add cordova-plugin-secure-key-store

or via github

cordova plugin add https://github.com/pradeep1991singh/cordova-plugin-secure-key-store

Usage

This plugin will add three new methods to window scope, for saving sensitive data, retrieving saved data and for removing data.

  • For saving use cordova.plugins.SecureKeyStore.set
cordova.plugins.SecureKeyStore.set(function (res) {
  console.log(res); // res - string securely stored
}, function (error) {
  console.log(error);
}, "key", 'string to encrypt');
  • For retrieving use cordova.plugins.SecureKeyStore.get.
cordova.plugins.SecureKeyStore.get(function (res) {
  console.log(res); // res - string retrieved
}, function (error) {
  console.log(error);
}, "key");
  • And for removing cordova.plugins.SecureKeyStore.remove
cordova.plugins.SecureKeyStore.remove(function (res) {
  console.log(res); // res - string removed
}, function (error) {
  console.log(error);
}, "key");

License

MIT License

Copyright (c) 2017 pradeep singh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Buy Me A Coffee

cordova-plugin-secure-key-store's People

Contributors

giordanocardillo avatar nakagawa-yoshiki avatar pradeep1991singh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-secure-key-store's Issues

Not working with 1.5.4

I tried to integrate the plugin in Cordova project to secure my passwords, I can see the object {"serviceName":"SecureKeyStore"} when calling window.cordova.plugins.SecureKeyStore, but when i tried to set/get values i can't see any value

I found one more issue in iOS

Hello pradeepsingh,

I found one more issue in iOS. where i installed app and stored some id then i did uninstalled app in my device then again i installed my device on that time i got all stored value again. it should be clear from storage.
Can you plz resolve it?

Let me know if you need any more clarification

Thanks you

javax.crypto.IllegalBlockSizeException

Error getting <> from securekeystore{"code":1,"api-level":26,"message":javax.crypto.IllegalBlockSizeException}

Unable to get saved password from secure key store

Version 1.4.3 not untar properly

cordova config.xml
<plugin name="cordova-plugin-secure-key-store" spec="~1.4.0" />

When cordova prepare or add platform I always get
Discovered plugin "cordova-plugin-secure-key-store" in config.xml. Adding it to the project Fetching plugin "cordova-plugin-secure-key-store@~1.4.0" via npm Error during untar for C:\Users\user\.cordova\lib\npm_cache\cordova-plugin-secure-key-store\1.4.3\package.tgz: Error: invalid tar file Error during untar for C:\Users\user\.cordova\lib\npm_cache\cordova-plugin-secure-key-store\1.4.3\package.tgz: Error: invalid tar file Error during untar for C:\Users\user\.cordova\lib\npm_cache\cordova-plugin-secure-key-store\1.4.3\package.tgz: Error: invalid tar file Failed to restore plugin "cordova-plugin-secure-key-store" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-plugin-secure-key-store@~1.4.0 via registry. Probably this is either a connection problem, or plugin spec is incorrect.

When I tried with spec="1.4.2" this will work fine.
I also tried spec="1.4.3" and will have the same issue above.
Please check if 1.4.3 is properly working because my tgz cannot extract by cordova

Getting "mutating method sent to immutable object" error

Freshly installed app throws following error when attempting to store value for key first time:

 {"code":9,"message":"error saving key, please try to un-install and re-install app again","actual-error":-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object}

Reinstalling the app does not help.

@pradeep1991singh any suggestions how to resolve it?

error object is wrongfully parsed

Hi.

I'm just testing if the plugin works as expected, as the other one (cordova-plugin-securestorage) is deprecated.

getting an item from the storage, if storage is there, returns this stringified json:

"{"code":1,"api-level":27,"message":RSA private or public key is null}"

However, this output is invalid as the message should be in quotes. The correct output should be:

"{"code":1,"api-level":27,"message":"RSA private or public key is null"}"

Tested on:

  • android devices

If you need more info, give me a shout.

Max entry size

What is the maximum size for a single key to be successfully stored?
I've been experimenting with longer strings (up to 1K characters) and was surprised that it stores the keys of such length without errors. But when getting back these keys strings come empty.
I realize this really depends on hardware limitations but I could not find any documented max size. Any info?

It would also be nice to have some kind of error/warning if the key is too large and is not going to be saved well.

Many thanks!

input must be under 256 bytes

I'm trying to store a JWT on Android and get the following error message:

{ "code": 9, "api-level": 22, "message": "input must be under 256 bytes" }

Is there any way to get around this limit?

Error while using cordova.plugins.SecureKeyStore.get for the key that doesn't exist.

Hi,
I am getting error while using get method for the key that doesnot exist in keystore.
cordova.plugins.SecureKeyStore.get(function (res) {
alert(res);
}, function (error) {
alert(error);
}, "abc");

ERROR MESSAGE:
Api-level:21
Exception: Need RSA private or public key

Can I get some error code that state key doesn't exist instead of above message

1.5.5

Dear Pradeep, first and most important: thank you very much for such a great plugin.
Are you planning to push version 1.5.5 (latest fix for ios keys) to NPM ?

Thanks again, kind regards,
Julian

Error if value is too long

It looks like there is a max length for the value to be stored...
I tried To store a long string (1159 charcaters), and I got this error:

{"code":9,"api-level":27,"message":javax.crypto.IllegalBlockSizeException: input must be under 256 bytes}

E/SecureKeyStore: Exception: Need RSA private or public key

When running in an AngularJS Phonegap app, the get function is throwing the error E/SecureKeyStore: Exception: Need RSA private or public key. I added a timeout of 30 seconds to the function to make sure it wasn't a "not-loaded-in-time" issue. Not sure how to overcome this.

Ios getting last stored value and replace all other key value with last stored value

In ios i have stored 2 value first store app_id (key), and value is 12345. and second value stored as pass user_pass (key) and value is 12345_pass. when i close app and again open i am getting both key with 12345_pass as value.
I am try to solve but i am not getting any solution. Can you plz help us to solve out this issue.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.