import { Readable } from '@web5/common'; export declare enum CipherAlgorightm { AES_256_CBC = "aes-256-cbc", AES_256_CTR = "aes-256-ctr" } export declare class DcxStreamCipher { algorithm: CipherAlgorightm; constructor(algorithm: CipherAlgorightm); /** * Encrypts the given plaintext stream using the specified algorithm * @param key the encryption key * @param initVector the initialization vector * @param plaintextStream the plaintext stream to encrypt * @returns the encrypted stream */ encryptStream(key: Buffer, initVector: Buffer, plaintextStream: Readable): Promise; /** * Decrypts the given cipher stream using the specified algorithm * @param key the encryption key * @param initVector the initialization vector * @param cipherStream the cipher stream to decrypt * @returns the decrypted stream */ decryptStream(key: Buffer, initVector: Buffer, cipherStream: Readable): Promise; /** * aes-256-cbc * key size: 256 bits (32 bytes) * iv size: 128 bits (16 bytes) */ /** * Encrypts the given plaintext stream using aes-256-cbc algorithm. * @param key the encryption key * @param initVector the initialization vector * @param plaintextStream the plaintext stream to encrypt * @returns the encrypted stream */ static aes256CbcEncryptStream(key: Buffer, initVector: Buffer, plaintextStream: Readable): Promise; /** * Decrypts the given cipher stream using aes-256-cbc algorithm. * @param key the encryption key * @param initVector the initialization vector * @param cipherStream the cipher stream to decrypt * @returns the decrypted stream */ static aes256CbcDecryptStream(key: Buffer, initVector: Buffer, cipherStream: Readable): Promise; /** * aes-256-ctr * key: 256 bits (32 bytes) * iv: 128 bits (16 bytes) */ /** * Encrypts the given plaintext stream using aes-256-ctr algorithm. * @param key the encryption key * @param initVector the initialization vector * @param plaintextStream the plaintext stream to encrypt * @returns the encrypted stream */ static aes256CtrEncryptStream(key: Buffer, initVector: Buffer, plaintextStream: Readable): Promise; /** * Decrypts the given cipher stream using aes-256-ctr algorithm. * @param key the encryption key * @param initVector the initialization vector * @param cipherStream the cipher stream to decrypt * @returns the decrypted stream */ static aes256CtrDecryptStream(key: Buffer, initVector: Buffer, cipherStream: Readable): Promise; } export declare class DcxCipher extends DcxStreamCipher { constructor(algorithm: CipherAlgorightm); /** * Encrypts the given plaintext message using the specified algorithm * @param key the encryption key * @param initVector the initialization vector * @param plaintext the plaintext message to encrypt * @returns the encrypted message in base64 format using the specified algorithm */ encrypt(key: Buffer, initVector: Buffer, plaintext: string): Promise; /** * Decrypts the given ciphertext message using the specified algorithm * @param key the encryption key * @param initVector the initialization vector * @param ciphertext the encrypted message in base64 format * @returns the decrypted message in utf-8 format using the specified algorithm */ decrypt(key: Buffer, initVector: Buffer, ciphertext: string): Promise; /** * * @param key the encryption key * @param plaintext the plaintext message * @param initVector the initialization vector * @returns the encrypted message in base64 format using aes-256-cbc algorithm */ static aes256CbcEncrypt(key: Buffer, initVector: Buffer, plaintext: string): string; /** * * @param key the encryption key * @param cipher the encrypted message * @param initVector the initialization vector * @returns the decrypted message in utf-8 format using aes-256-cbc algorithm */ static aes256CbcDecrypt(key: Buffer, initVector: Buffer, cipher: string): string; /** * * @param key the encryption key * @param plaintext the plaintext message * @param initVector the initialization vector * @returns the encrypted message in base64 format using aes-256-ctr algorithm */ static aes256CtrEncrypt(key: Buffer, initVector: Buffer, plaintext: string): string; /** * * @param key the encryption key * @param cipher the encrypted message in format: initVector:cipher * @returns the decrypted message in utf-8 format using aes-256-ctr algorithm */ static aes256CtrDecrypt(key: Buffer, initVector: Buffer, cipher: string): string; } //# sourceMappingURL=cipher.d.ts.map