import { TextEncoding } from '../utils/encodingUtils'; import { IEncryptionAlgorithm, EncryptionResult, IEncryptionAlgorithmConfig } from './IEncryptionAlgorithm'; /** * Configuration interface for AES-GCM encryption. * * @remarks * This interface extends the base encryption configuration and only requires * a password. Salt and IV are automatically generated for each encryption * operation to ensure maximum security. */ export interface IAESGCMEncryptionConfig extends IEncryptionAlgorithmConfig { textEncoding?: TextEncoding; } /** * AES-GCM encryption implementation with automatic salt and IV generation. * * @remarks * This class provides secure AES-GCM encryption with the following security features: * - Automatic random salt generation (16 bytes) for each encryption * - Automatic random IV generation (12 bytes) for each encryption * - PBKDF2 key derivation with 100,000 iterations * - Authenticated encryption with built-in integrity protection * - Secure data format: [salt | iv | ciphertext] * * @example * ```typescript * const encryption = new AESGCMEncryption(); * const config = new AESGCMEncryptionConfig('my-password'); * * const encrypted = await encryption.encryptText('Hello World', config); * const decrypted = await encryption.decryptText(encrypted.data, config); * ``` */ export declare class AESGCMEncryption implements IEncryptionAlgorithm { /** * Encrypts a plaintext string using AES-GCM with automatic salt and IV generation. * * @param plaintext - The string to encrypt * @param configuration - The encryption configuration containing password and encoding * @param encoding - Optional text encoding override * @returns Promise resolving to encrypted data in format: [salt | iv | ciphertext] * * @remarks * Each call generates new random salt and IV, ensuring unique ciphertext even for identical plaintext. * The output format is: 16-byte salt + 12-byte IV + AES-GCM ciphertext (includes auth tag). */ encryptText(plaintext: string, configuration: IAESGCMEncryptionConfig, encoding?: TextEncoding): Promise; decryptText(encryptedData: ArrayBuffer, configuration: IAESGCMEncryptionConfig, encoding?: TextEncoding): Promise; encryptFile(fileBuffer: ArrayBuffer, configuration: IAESGCMEncryptionConfig): Promise; decryptFile(encryptedBuffer: ArrayBuffer, configuration: IAESGCMEncryptionConfig): Promise; } export declare class AESGCMEncryptionConfig implements IAESGCMEncryptionConfig { password: string; textEncoding?: TextEncoding; constructor(password: string, textEncoding?: TextEncoding); }