import { TextEncoding } from '../utils/encodingUtils'; export interface EncryptionResult { data: ArrayBuffer; } export interface IEncryptionAlgorithmConfig { password: string; textEncoding?: TextEncoding; } export interface IEncryptionAlgorithm { /** * Encrypt a plaintext string. * @param plaintext The string to encrypt. * @param algorithmConfig The encryption algorithm configuration. * @param encoding The text encoding to use, defaults to `textEncoding` from the algorithm config. */ encryptText(plaintext: string, algorithmConfig: T, encoding?: TextEncoding): Promise; /** * Decrypt an encrypted text. * @param encryptedData The ArrayBuffer containing the ciphertext. * @param algorithmConfig The encryption algorithm configuration. * @param encoding The text encoding to use, defaults to `textEncoding` from the algorithm config. */ decryptText(encryptedData: ArrayBuffer, algorithmConfig: T, encoding?: TextEncoding): Promise; /** * Encrypt a file (binary data). * @param fileBuffer The ArrayBuffer of file data. * @param algorithmConfig The encryption algorithm configuration. * @param encoding The text encoding to use, defaults to `textEncoding` from the algorithm config. */ encryptFile(fileBuffer: ArrayBuffer, algorithmConfig: T, encoding?: TextEncoding): Promise; /** * Decrypt file data. * @param encryptedBuffer The ArrayBuffer of encrypted file data. * @param algorithmConfig The encryption algorithm configuration. * @param encoding The text encoding to use, defaults to `textEncoding` from the algorithm config. */ decryptFile(encryptedBuffer: ArrayBuffer, algorithmConfig: T, encoding?: TextEncoding): Promise; } export type EncryptionConfigType = T extends IEncryptionAlgorithm ? C : never;