UNPKG

@monitoro/herd

Version:

Automate your browser, build AI web tools and MCP servers with Monitoro Herd

65 lines (64 loc) 1.66 kB
import { HerdClient } from '../HerdClient.js'; export interface CacheOptions { cacheDirectory?: string; autoCleanup?: boolean; } /** * Manages the encrypted cache for trail files * This is internal to the TrailEngine and not meant to be accessed directly */ export declare class CacheManager { private cacheDirectory; private client; private encryptionKey; private keyExpiry; /** * Creates a new CacheManager instance */ constructor(client: HerdClient, options?: CacheOptions); /** * Get path to cache directory */ getCacheDirectory(): string; /** * Store data in the encrypted cache with auto-prefixing */ store(key: string, data: string | Buffer): Promise<string>; /** * Retrieve data from the encrypted cache */ retrieve(key: string): Promise<string | null>; /** * Check if a key exists in the cache */ exists(key: string): Promise<boolean>; /** * Clear the entire cache */ clear(): Promise<void>; /** * Ensure the cache directory exists */ private ensureCacheDirectory; /** * Create a hash of a string for filename */ private hashString; /** * Encrypt data using the current encryption key */ private encrypt; /** * Decrypt data using the current encryption key */ private decrypt; /** * Ensure we have a valid encryption key */ private ensureEncryptionKey; /** * Create a fallback key based on local machine info * This is used only if we can't get a key from the server */ private createFallbackKey; }