1.0.4 • Published 3 years ago

light-secure-storage v1.0.4

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

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