UNPKG

easy-cipher-mate

Version:

A CLI and programmatic tool for encryption/decryption supporting AES-GCM and ChaCha20-Poly1305 algorithms, with text encoding options and line-by-line text file processing.

23 lines (22 loc) 1.3 kB
import { IEncryptionAlgorithm, EncryptionResult, IEncryptionAlgorithmConfig } from './IEncryptionAlgorithm'; import { TextEncoding } from '../utils/encodingUtils'; export interface IChaCha20Poly1305EncryptionConfig extends IEncryptionAlgorithmConfig { textEncoding?: TextEncoding; } export declare class ChaCha20Poly1305Encryption implements IEncryptionAlgorithm<IChaCha20Poly1305EncryptionConfig> { static TAG_LENGTH: number; static KEY_LENGTH: number; static ITERATIONS: number; static NONCE_LENGTH: number; encryptText(plaintext: string, config: IChaCha20Poly1305EncryptionConfig, encoding?: TextEncoding): Promise<EncryptionResult>; decryptText(encryptedData: ArrayBuffer, config: IChaCha20Poly1305EncryptionConfig, encoding?: TextEncoding): Promise<string>; encryptFile(fileBuffer: ArrayBuffer, config: IChaCha20Poly1305EncryptionConfig): Promise<EncryptionResult>; decryptFile(encryptedBuffer: ArrayBuffer, config: IChaCha20Poly1305EncryptionConfig): Promise<ArrayBuffer>; private deriveKey; validateNonce(nonce: Buffer): void; } export declare class ChaCha20Poly1305EncryptionConfig implements IChaCha20Poly1305EncryptionConfig { password: string; textEncoding?: TextEncoding; constructor(password: string, textEncoding?: TextEncoding); }