nucypher-experimental-taco-storage
Version:
TypeScript SDK for encrypted data storage with TACo (Threshold Access Control), supporting multiple storage providers including IPFS and SQLite
73 lines • 2.14 kB
TypeScript
/**
* SQLite storage adapter implementation
*/
import { BaseStorageAdapter } from './base';
import { AdapterConfig, StorageMetadata, StorageResult } from '../types';
/**
* Configuration interface for SQLite adapter
*/
export interface SQLiteAdapterConfig extends AdapterConfig {
/** Path to SQLite database file (defaults to in-memory) */
databasePath?: string;
/** Whether to enable WAL mode for better concurrency */
enableWAL?: boolean;
/** Connection timeout in milliseconds */
timeout?: number;
}
/**
* SQLite storage adapter for local/centralized data storage
*/
export declare class SQLiteAdapter extends BaseStorageAdapter {
private readonly db;
private readonly dbPath;
private readonly timeout;
private isClosed;
private readonly dbRun;
private readonly dbGet;
private readonly dbAll;
constructor(config?: SQLiteAdapterConfig);
/**
* Initialize the SQLite adapter by setting up database schema and testing connectivity
*/
initialize(): Promise<void>;
protected generateReference(id: string): string;
/**
* Setup database schema and configuration asynchronously
*/
private setupDatabase;
/**
* Store encrypted data and metadata in SQLite
*/
store(encryptedData: Uint8Array, metadata: StorageMetadata): Promise<StorageResult>;
/**
* Retrieve encrypted data and metadata from SQLite
*/
retrieve(id: string): Promise<{
encryptedData: Uint8Array;
metadata: StorageMetadata;
}>;
/**
* Delete data from SQLite
*/
delete(id: string): Promise<boolean>;
/**
* Check if data exists in SQLite
*/
exists(id: string): Promise<boolean>;
/**
* List stored data IDs with pagination
*/
list(limit?: number, offset?: number): Promise<string[]>;
/**
* Get SQLite database health status
*/
getHealth(): Promise<{
healthy: boolean;
details?: Record<string, unknown>;
}>;
/**
* Clean up SQLite database connection
*/
cleanup(): Promise<void>;
}
//# sourceMappingURL=sqlite.d.ts.map