Secure encryption and storage for JavaScript & TypeScript.
Zero dependencies • AES-256-GCM • Type-safe • Cross-platform
- 🔒 Secure by Default - Military-grade AES-256-GCM encryption
- 📦 Zero Dependencies - No supply chain vulnerabilities
- 🎯 Type-Safe - Full TypeScript support with strict typing
- ✅ Production-Ready - 93% test coverage, battle-tested
- ⚡ Simple API - 3 lines to encrypt localStorage
- 🌐 Universal - Works in Browser, Node.js, Deno, and Bun
npm install @azemzemi/cryptoboximport { createSecureLocalStorage } from '@azemzemi/cryptobox';
const storage = createSecureLocalStorage();
await storage.setSecure('user', { id: 123 }, 'password');
const user = await storage.getSecure('user', 'password');- AES-256-GCM encryption with PBKDF2
- Zero dependencies
- Full TypeScript support
- Browser, Node.js 18+, Deno, Bun
- 93% test coverage
// Authentication tokens
await storage.setSecure('auth', { jwt: 'xxx', refresh: 'yyy' }, password);
// Sensitive user data
await storage.setSecure('payment', { cardLast4: '1234' }, password);
// Form auto-save
await storage.setSecure('draft', { title: 'Post', content: '...' }, password);createSecureLocalStorage() // Browser: localStorage
createSecureSessionStorage() // Browser: sessionStorage
createSecureMemoryStorage() // Universal: in-memoryimport { AesGcmEncryptor } from '@azemzemi/cryptobox';
const encryptor = new AesGcmEncryptor();
const encrypted = await encryptor.encrypt(data, 'password');
const decrypted = await encryptor.decrypt(encrypted, 'password');import { SecureStorage, AesGcmEncryptor, IStorage } from '@azemzemi/cryptobox';
class MyStorage implements IStorage {
setItem(key: string, value: string): void { }
getItem(key: string): string | null { return null; }
removeItem(key: string): void { }
}
const storage = new SecureStorage(new MyStorage(), new AesGcmEncryptor());- AES-256-GCM authenticated encryption
- PBKDF2-HMAC-SHA256 (100,000 iterations)
- Random salt and IV per operation
- Timing-attack protection
See SECURITY.md for vulnerability reporting.
MIT