0.1.0 • Published 3 years ago

secure-storage-web v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

secure-storage-web

The data will be stored using CryptoJS AES (Advanced Encryption Standard)

A secure storage for web application

npm MIT

Demo

You can see the demo here

Installation

npm install secure-storage-web --save

or

yarn add secure-storage-web --save

Usage

In Web application

In side index.html

<script src="node_modules/secure-storage-web/dist/secure-storage-web.js"></script>

In js file where you want to use this package

var config = { name: 'test', type: 'localStorage', secretKey: 'test' };
var store = new SecureStorageWeb(config);

store.setItem('key1', { a: 12345 });

store.getItem('key1');

In Vue application

In your main.js file

import SecureStorageWeb from 'secure-storage-web';

var config = { name: 'test', type: 'localStorage', secretKey: 'test', secure: true };
var store = new SecureStorageWeb(config);

Vue.prototype.store = store;

In vue.js components where you want to use this package

this.store.setItem('key1', { a: 12345 });

this.store.get('key1');

Configuration Options

OptionTypeDefault ValueDescription
nameStringappYou can give your application name so that all your keys in browser storage will be prepended with your name of the application
typeStoragelocalStorageYou can use either localStorage or sessionStorage
secretKeyStringSECRET_KEYYou can use any secret key
secureBooleantrueYou can enable or disable encryption / decryption with this value

Usage of configuration options

var config = { name: 'test', type: 'localStorage', secretKey: 'test', secure: true };
var store = new SecureStorageWeb(config);

Methods

MethodSyntaxDescription
setItemsetItem('key', value)Set the item in to browser storage.
getItemgetItem('key')Get the item from browser storage.
deleteItemdeleteItem('key')Delete the item from storage.
getAllItemsgetAllItems()Get all the items from storage.
deleteAllItemsdeleteAllItems()Delete all the items from storage.
getAllKeysgetAllKeys()Get all the keys stored.
getLengthgetLength()Get the length of items stored.

npm package

You can find npm registry link here

License

MIT

Release Notes

v0.0.1

  • Initial version with basic storage with encryption and decryption

v0.0.2

  • Initial version with basic storage with encryption and decryption
  • Added demo for web application

v0.0.3

  • Added optional feature to enable or disabled encryption and decryption
  • Added vue.js app demo

v0.1.0

  • Stable version release

v0.2.0

  • Keys will be fetched based on the configuration
  • Updated Readme with configuration options and methods

Contact

0.2.0

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago