React Secure Storage (v1.3.2) is a wrapper around localStorage that encrypts stored data using a browser fingerprint and an optional user-provided secret key. It generates a unique encryption key per browser, ensuring data can only be decrypted in the same browser that encrypted it. Supports storing String, Object, Number, and Boolean without manual serialization. Uses a singleton pattern for in-memory caching. Works with React, Vite, and Next.js via environment variables. Lightweight and dependency-free. Compatible with TypeScript.
npm install react-secure-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: importing the library, setting and getting items of different types, and clearing storage.
This is by design; if cross-browser decryption is needed, use a static encryption key instead.
Use import.meta.env.VITE_SECURE_LOCAL_STORAGE_HASH_KEY and ensure prefix is VITE_.
Always set SECURE_LOCAL_STORAGE_HASH_KEY (with appropriate prefix) to a strong secret.
Upgrade to latest version and migrate data if necessary.
Use import SecureStorage from 'react-secure-storage'.
For Vite, use import.meta.env and define variables with VITE_ prefix.
Check returned value before using: const val = SecureStorage.getItem('key'); if (val !== null) { ... }No dependency data recorded yet.