secure-json-cache
v1.0.0
Published
Secure frontend JSON cache with encryption and TTL, like Redis.
Maintainers
Readme
🔐 secure-json-cache
Secure frontend JSON cache with TTL and encryption — a Redis-like local state/cache system for frontend apps.
Works well with React, Vue,Angular, or any vanilla JS frontend project.
🚀 Features
- ✅ Encrypted storage using Web Crypto (AES-GCM)
- ✅ Uses IndexedDB (not readable via DevTools like localStorage)
- ✅ Redis-style API: set, get, reset
- ✅ TTL (auto-expiry after 48 hrs or custom time)
- ✅ Lightweight, no dependencies
📦 Install
npm install secure-json-cache📚 Usage
import cache from 'secure-json-cache';
await cache.set('user', { name: 'Hasnat' }, { ttl: 3600 });
const user = await cache.get('user');
await cache.reset('user');⚛️ Use in React
const [user, setUser] = useState(null);
useEffect(() => {
cache.get('user').then(setUser);
}, []);📃 License
MIT
