UNPKG

@entro314labs/ai-changelog-generator

Version:

AI-powered changelog generator with MCP server support - works with most providers, online and local models

133 lines (132 loc) 3.52 kB
/** * Config File Storage Backend * * Stores credentials in encrypted JSON file at: * ~/.config/ai-changelog/credentials.json * * Features: * - AES-256-GCM encryption * - Device-specific key derivation * - Metadata storage (auth type, created date, etc.) */ import { BaseStorage } from './base-storage.js'; interface EncryptedPayload { encrypted: string; salt: string; iv: string; tag: string; } interface DecryptedCredential { value: string; metadata?: Record<string, any>; } export declare class ConfigStorage extends BaseStorage { [key: string]: any; constructor(options?: Record<string, any>); /** * Ensure config directory exists * @private */ _ensureConfigDir(): void; /** * Get or create master key * @private * @returns {Buffer} */ _getMasterKey(): any; /** * Derive encryption key from master key and salt * @private * @param {Buffer} salt - Salt for key derivation * @returns {Buffer} */ _deriveKey(salt: any): NonSharedBuffer; /** * Encrypt data * @private * @param {string} data - Data to encrypt * @returns {Object} { encrypted: string, salt: string, iv: string, tag: string } */ _encrypt(data: any): { encrypted: string; salt: string; iv: string; tag: string; }; /** * Decrypt data * @private * @param {Object} encryptedData - { encrypted, salt, iv, tag } * @returns {string} */ _decrypt(encryptedData: EncryptedPayload): string; /** * Load credentials from file * @private * @returns {Object} */ _loadCredentials(): Record<string, DecryptedCredential>; /** * Save credentials to file * @private * @param {Object} credentials - Credentials object */ _saveCredentials(credentials: Record<string, DecryptedCredential>): void; /** * Get credential for a provider * @param {string} provider - Provider name * @returns {Promise<string|null>} */ get(provider: any): Promise<string | null>; /** * Set credential for a provider * @param {string} provider - Provider name * @param {string} credential - Credential value * @param {Object} metadata - Additional metadata * @returns {Promise<void>} */ set(provider: any, credential: any, metadata?: Record<string, any>): Promise<void>; /** * Delete credential for a provider * @param {string} provider - Provider name * @returns {Promise<boolean>} */ delete(provider: any): Promise<boolean>; /** * List all providers with credentials * @returns {Promise<string[]>} */ list(): Promise<string[]>; /** * Get metadata for a credential * @param {string} provider - Provider name * @returns {Promise<Object|null>} */ getMetadata(provider: any): Promise<Record<string, any> | null>; /** * Check if storage is available * @returns {Promise<boolean>} */ isAvailable(): Promise<boolean>; /** * Get storage type identifier * @returns {string} */ getType(): string; /** * Get human-readable storage name * @returns {string} */ getName(): string; /** * Get priority for this storage type * @returns {number} */ getPriority(): number; /** * Get config file path * @returns {string} */ getConfigPath(): any; } export default ConfigStorage;