light-secure-storage

1.0.4 • Public • Published

Light secure storage

Light secure storage is a lightweight library designed to keep localStorage/sessionStorage encrypted for security, while still maintaining the same functionality and usage.

Installation

npm install light-secure-storage

Usage

It is recommended to use this storage as a singleton, although not required.

localStorage

import LightSecureStorage from 'light-secure-storage';

const options = { type: 'localStorage' }
const myStorage = new LightSecureStorage('my secret key', options)

myStorage.setItem('some key', 'some value');
console.log(myStorage.getItem('some key')); // prints 'some value'
myStorage.removeItem('some key');

sessionStorage

import LightSecureStorage from 'light-secure-storage';

const options = { type: 'sessionStorage' }
const myStorage = new LightSecureStorage('my secret key', options)

myStorage.setItem('some key', 'some value');
console.log(myStorage.getItem('some key')); // prints 'some value'
myStorage.removeItem('some key');

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Package Sidebar

Install

npm i light-secure-storage

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

4.99 kB

Total Files

7

Last publish

Collaborators

  • grovine