
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
locked-storage
Advanced tools
A JavaScript library that provides cryptographically encrypted local and session storage with automatic key/value encryption and synchronous API
A lightweight JavaScript library that provides cryptographically encrypted localStorage and sessionStorage with automatic key/value encryption.
npm install locked-storage
import { createLockedLocalStorage } from 'locked-storage';
// Create an encrypted localStorage instance
const lockedStorage = createLockedLocalStorage('your-secret-master-key');
// Use it just like regular localStorage
lockedStorage.setItem('username', 'john_doe');
const username = lockedStorage.getItem('username'); // 'john_doe'
import { createLockedLocalStorage, createLockedSessionStorage } from 'locked-storage';
// localStorage with encryption
const secureLocal = createLockedLocalStorage('my-secret-key');
secureLocal.setItem('sensitive-data', 'confidential-value');
// sessionStorage with encryption
const secureSession = createLockedSessionStorage('my-secret-key');
secureSession.setItem('session-token', 'abc-123-xyz');
<!-- Include crypto-js first -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js"></script>
<script src="node_modules/locked-storage/index.js"></script>
<script>
const lockedStorage = LockedStorage.createLockedLocalStorage('my-key');
lockedStorage.setItem('data', 'value');
const data = lockedStorage.getItem('data');
console.log(data); // 'value'
</script>
const { createLockedLocalStorage } = require('locked-storage');
const storage = createLockedLocalStorage('my-secret-key');
storage.setItem('config', JSON.stringify({ theme: 'dark' }));
const config = storage.getItem('config');
console.log(JSON.parse(config)); // { theme: 'dark' }
import { LockedStorage } from 'locked-storage';
// Custom instance with explicit storage type
const customStorage = new LockedStorage('master-key', 'sessionStorage');
// Store complex data (serialize first)
const userData = { id: 123, name: 'Alice', roles: ['admin'] };
customStorage.setItem('user', JSON.stringify(userData));
// Retrieve and parse
const stored = customStorage.getItem('user');
const parsed = JSON.parse(stored);
console.log(parsed.name); // 'Alice'
// Clean up
customStorage.removeItem('user');
customStorage.clear(); // Removes all locked-storage items
createLockedLocalStorage(masterKey)Creates a new encrypted localStorage instance.
string - The master key for encryption/decryptionLockedStorage - Encrypted localStorage instancecreateLockedSessionStorage(masterKey)Creates a new encrypted sessionStorage instance.
string - The master key for encryption/decryptionLockedStorage - Encrypted sessionStorage instanceLockedStorage Classconstructor(masterKey, storageType?)string - Master key for encryption'localStorage' | 'sessionStorage' - Storage type (default: 'localStorage')setItem(key, value)Encrypts and stores a key-value pair.
string - The key (will be encrypted)string - The value (will be encrypted)voidgetItem(key)Retrieves and decrypts a value by key.
string - The key to look upstring | null - Decrypted value or null if not foundremoveItem(key)Removes an encrypted item by key.
string - The key to removevoidclear()Removes all items created by locked-storage.
voidFull TypeScript support included with type definitions.
import { LockedStorage, createLockedLocalStorage } from 'locked-storage';
const storage: LockedStorage = createLockedLocalStorage('key');
const value: string | null = storage.getItem('myKey');
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © PackageReleaser
FAQs
A JavaScript library that provides cryptographically encrypted local and session storage with automatic key/value encryption and synchronous API
We found that locked-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.