trojanhorse-js
Version:
A comprehensive JavaScript library for fetching, managing, and analyzing global threat intelligence from multiple open-source feeds and security news sources. Unlike its mythological namesake, this Trojan protects your digital fortress.
57 lines • 1.85 kB
TypeScript
import Dexie from 'dexie';
import { StorageQuota, EncryptedVault, ThreatIndicator } from '../types';
export interface StorageEntry {
id?: number;
key: string;
encryptedData: string;
iv: string;
timestamp: number;
expiresAt?: number;
tags?: string[];
size: number;
}
export interface StorageConfig {
dbName: string;
encryptionKey: string;
maxSizeBytes?: number;
defaultTTL?: number;
compressionEnabled?: boolean;
}
export declare class SecureStorage extends Dexie {
private storage;
private config;
private isInitialized;
constructor(config: StorageConfig);
initialize(): Promise<void>;
store(key: string, data: any, options?: {
ttl?: number;
tags?: string[];
compress?: boolean;
}): Promise<void>;
retrieve<T = any>(key: string): Promise<T | null>;
deleteData(key: string): Promise<boolean>;
storeThreatIndicators(indicators: ThreatIndicator[], source: string, ttl?: number): Promise<void>;
getThreatIndicators(source: string): Promise<ThreatIndicator[] | null>;
storeVault(vault: EncryptedVault, key?: string): Promise<void>;
getVault(key?: string): Promise<EncryptedVault | null>;
findByTags(tags: string[]): Promise<StorageEntry[]>;
getStorageStats(): Promise<StorageQuota & {
totalEntries: number;
expiredEntries: number;
tagStats: Record<string, number>;
}>;
cleanup(): Promise<{
deletedEntries: number;
freedBytes: number;
}>;
clear(): Promise<void>;
createBackup(): Promise<string>;
restoreBackup(encryptedBackup: string): Promise<void>;
private ensureInitialized;
private checkStorageQuota;
private compress;
private decompress;
private isCompressed;
private calculateHash;
}
//# sourceMappingURL=SecureStorage.d.ts.map