
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
secure-web-storage
Advanced tools
A simple wrapper for localStorage/sessionStorage that allows one to encrypt/decrypt the data being stored.
A simple wrapper for localStorage/sessionStorage that allows one to encrypt/decrypt the data being stored.
$ npm install secure-web-storage
var CryptoJS = require("crypto-js");
var SECRET_KEY = 'my secret key';
var secureStorage = new SecureStorage(localStorage, {
hash: function hash(key) {
key = CryptoJS.SHA256(key, SECRET_KEY);
return key.toString();
},
encrypt: function encrypt(data) {
data = CryptoJS.AES.encrypt(data, SECRET_KEY);
data = data.toString();
return data;
},
decrypt: function decrypt(data) {
data = CryptoJS.AES.decrypt(data, SECRET_KEY);
data = data.toString(CryptoJS.enc.Utf8);
return data;
}
});
var data = {
secret: 'data'
};
// there is no need to stringify/parse you objects before and after storing.
secureStorage.setItem('data', data);
// stores in localStorage like:
// key => value
// "ad36d572..." => "w1svi6n..."
var decryptedData = secureStorage.getItem('data');
// returns { secret: 'data' }
secureStorage.removeItem('data');
// removes the entry 'data'
secureStorage.key(id)
// returns the hashed version of the key you passed into setItem with the given id.
secureStorage.clear();
// clears all data in the underlining sessionStorage/localStorage.
secureStorage.length;
// the number of entries in the underlining sessionStorage/localStorage.
FAQs
A simple wrapper for localStorage/sessionStorage that allows one to encrypt/decrypt the data being stored.
The npm package secure-web-storage receives a total of 5,189 weekly downloads. As such, secure-web-storage popularity was classified as popular.
We found that secure-web-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.