Changelog
All notable changes to vali-storages are documented here.
Format: Keep a Changelog — versioning follows Semantic Versioning.
[2.1.0] — 2026-04-07
Refactored
- Extracted cross-tab synchronization into a dedicated
CrossTabSyncclass (SRP).
ValiStoragesnow delegates allstorageevent handling — registration, key unprefixing, plain/encrypted dispatch, and teardown — to this internal class. No public API changes.
Fixed
updateExpirynow routes throughsafeStorageSet(consistent quota-exceeded handling).cryptoInstancefield typed asICrypto | null; access is guarded at every call site to eliminate the previousnull!non-null assertion.- Cross-tab decrypt path safely handles an encrypted item arriving at a non-encrypted instance (returns
nullinstead of throwing).
[2.0.0] — 2024-12-01
Breaking Changes
setItemis now async — returnsPromise<void>instead ofvoid. Addawaitto all calls.getItemno longer uses a callback — returnsPromise<T | null>directly.
// v1.x
storage.setItem('key', value);
storage.getItem('key', (item) => console.log(item));
// v2.0.0
await storage.setItem('key', value);
const item = await storage.getItem('key');
Added
setItems(items)— batch write multiple keys in parallelgetItems(keys)— batch read multiple keys in parallelgetAll()— return all non-expired items in the namespacegetOrSet(key, factory)— cache pattern: return existing or compute and storehas(key)— check key existence without decryptingremoveExpired()— purge all expired keys in the namespaceupdateExpiry(key)— manually reset TTL of an existing keysize()— count of items in the namespaceprefixoption — namespace isolation between instancesslidingExpirationoption — reset TTL on every successful readonErroroption —'throw'|'silent'| custom handleronChangeoption — cross-tab synchronization callbackcreateTypedStorage<Schema>()— compile-time type-safe factoryValiStorages.isAvailable()— static SSR guarddestroy()— removes the cross-tab event listener
Fixed
- Errors in
setItemwere silently swallowed in v1.x — now they propagate to the caller
[1.1.0] — 2024-09-15
Added
useSessionStorageoption — usesessionStorageinstead oflocalStorageAES.AES_192key size option
Fixed
- Key collision when two instances shared the same
prefixwith differentkeySize
[1.0.0] — 2024-07-01
Added
ValiStoragesclass with AES-GCM encryption via Web Crypto APIAES.AES_128andAES.AES_256key sizes- TTL expiration with
timeExpiration+TimeUnit(SECONDS,MINUTES,HOURS,DAYS) setItem/getItem/removeItem/clear/getAllKeyspredefinedKeyfor deterministic key derivation