light-secure-storage
v1.0.4
Published
Lightweight session/local storage encryption.
Downloads
12
Maintainers
Readme
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.