json-secure-store
Version:
Typed JSON storage wrapper for localStorage/sessionStorage with optional encryption.
21 lines (20 loc) • 612 B
TypeScript
import { StorageOptions, StorageAdapter, ChangeCallback } from './types';
export declare class JsonStore implements StorageAdapter {
private storage;
private encrypt;
private encryptionKey?;
private cache;
private namespace?;
private listeners;
private options;
private memoryCache;
constructor(options?: StorageOptions);
private buildKey;
private notifyChange;
onChange(callback: ChangeCallback): void;
setItem<T>(key: string, value: T): void;
getItem<T>(key: string): T | null;
removeItem(key: string): void;
clear(): void;
raw(): Storage;
}