UNPKG

persistent-storage

Version:

Abstracts access to any storage object implementing the webstorage Storage interface, offering optional compression using lz-string and optional encryption using crypto

28 lines (27 loc) 993 B
/// <reference types="node" /> export interface Options { algorithm: string; key: string; iv: Buffer; } export declare function generateSalt(lengthBytes: number): string; export declare function generateIV(lengthBytes: number): Buffer; export declare class KeyDerivationOptions { password: string; salt: string; iterations: number; derivedKeyLength: number; digest: string; constructor(opts: { password: string; salt?: string; iterations?: number; derivedKeyLength?: number; digest?: string; }); } export declare function deriveEncryptionKey(options: KeyDerivationOptions): string; export declare function encryptUtf8(str: string, options: Options): string; export declare function encryptUcs2(str: string, options: Options): string; export declare function decryptUtf8(str: string, options: Options): string; export declare function decryptUcs2(str: string, options: Options): string;