Module for securing browser's storage - local storage and session storage. Storing plain text in browser's storage could lead to security issues. For example, any user can change data stored in storage to change behaviour of application. Securing browser storage would implement one level of security (atleast not every user will be able to change stored data, this will require additional capabilities to alter data). Only application code would be able to read/write the browser's storage.
This module could be used in Angular, React or any other client side framework or library which supports 'npm modules'
npm i secured-browser-storage
import { securedBrowserCache } from 'secured-browser-storage';
securedBrowserCache.setStorageType('sessionStorage'); // Store data in browser's session storage
securedBrowserCache.setItem('key', 'value');
const val = securedBrowserCache.getItem('key', 'default value')
securedBrowserCache.removeItem('key');
securedBrowserCache.clear();
securedBrowserCache.config('new-secret-key', 'new-prefix-this-is-optional');
MIT
- Sunil Kumar
npm install secured-browser-storage