import * as sqlite from 'sql.js';
export interface EncryptedDataItem {
    salt: Uint8Array;
    iv: Uint8Array;
    data: Uint8Array;
}
/**
 * Pluggable compression codec. Supply your own (e.g. lz4-wasm, or the browser's
 * CompressionStream) to compress the database before it is encrypted and stored.
 *
 * The same codec must be supplied on both `save` and `load`. Both methods may be
 * sync or async. If no codec is supplied, data is stored uncompressed.
 */
export interface CompressionCodec {
    compress(data: Uint8Array): Uint8Array | Promise<Uint8Array>;
    decompress(data: Uint8Array): Uint8Array | Promise<Uint8Array>;
}
export declare namespace sqljsPersistence {
    function save(dbName: string, key: CryptoKey, db: Pick<sqlite.Database, 'export'>, codec?: CompressionCodec): Promise<void>;
    function load(dbName: string, passPhrase: string, sqlJsStatic: sqlite.SqlJsStatic, codec?: CompressionCodec): Promise<{
        database: sqlite.Database;
        key: CryptoKey;
    }>;
}
export declare namespace sqljsHelpers {
    function query<T>(db: Pick<sqlite.Database, 'exec'>, sql: string, params?: any[]): T[];
    function exec(db: Pick<sqlite.Database, 'exec'>, sql: string, params?: any[]): sqlite.QueryExecResult[];
    function run(db: Pick<sqlite.Database, 'run'>, sql: string, params?: any[]): void;
    function isTable(db: Pick<sqlite.Database, 'exec'>, table: string): boolean;
    function sanitizeParams(params: any[]): sqlite.SqlValue[];
}
export declare namespace compressionHelpers {
    function compress(data: Uint8Array, codec?: CompressionCodec): Promise<Uint8Array>;
    function decompress(data: Uint8Array, codec?: CompressionCodec): Promise<Uint8Array>;
}
export declare namespace cryptoHelpers {
    function getKey(passphrase: string, salt?: Uint8Array): Promise<{
        key: CryptoKey;
        salt: Uint8Array;
    }>;
    function encrypt(key: CryptoKey, salt: Uint8Array, data: Uint8Array): Promise<EncryptedDataItem>;
    function decrypt(key: CryptoKey, iv: BufferSource, encryptedData: BufferSource): Promise<ArrayBuffer>;
}
export declare namespace flushHelpers {
    function createAsyncFlushQueue(saveFn: () => Promise<void>): () => void;
}
