secure-timed-storage
Version:
Secure timed storage library for encrypting and managing data in localStorage with expiry
24 lines (19 loc) • 692 B
TypeScript
export declare function createSecureTimedStorage({ encryptionKey }: SecureTimedStorageOptions): IStorage;
export declare interface IStorage {
setItem(key: string, value: unknown, expiryInHours?: number | null): void;
getItem<T>(key: string): T | null;
removeItem(key: string): void;
getExpiry(key: string): number | null;
getRemainingStorage(): StorageInfo;
clearStorage(): void;
cleanUp(): void;
query<T>(predicate: (item: T) => boolean): T[];
}
export declare interface SecureTimedStorageOptions {
encryptionKey?: string;
}
export declare interface StorageInfo {
usedBytes: number;
remainingBytes: number;
}
export { }