/** * Implementation of the ChaCha20Poly1305 cipher. */ export declare class ChaCha20Poly1305 { /** * Instance of chacha20. * @internal */ private readonly _chacha; /** * Instance of poly1305 * @internal */ private readonly _poly; /** * The aad length. * @internal */ private _aadLength; /** * The cipher length. * @internal */ private _cipherLength; /** * The auth tag. * @internal */ private _authTag?; /** * Are we decrypting. * @internal */ private readonly _decrypt; /** * Do we have data. * @internal */ private _hasData; /** * Create a new instance of ChaCha20Poly1305. * @param key The key. * @param nonce The nonce. * @param decrypt Are we decrypting. * @internal */ private constructor(); /** * Create a ChaCha20Poly1305 encryptor. * @param key The key. * @param nonce The nonce. * @returns Encryptor instance of ChaCha20Poly1305. */ static encryptor(key: Uint8Array, nonce: Uint8Array): ChaCha20Poly1305; /** * Create a ChaCha20Poly1305 decryptor. * @param key The key. * @param nonce The nonce. * @returns Decryptor instance of ChaCha20Poly1305. */ static decryptor(key: Uint8Array, nonce: Uint8Array): ChaCha20Poly1305; /** * Set the AAD. * @param aad The aad to set. */ setAAD(aad: Uint8Array): void; /** * Update the cipher with more data. * @param input The input data to include. * @returns The updated data. */ update(input: Uint8Array): Uint8Array; /** * Finalise the data. */ final(): void; /** * Get the auth tag. * @returns The auth tag. */ getAuthTag(): Uint8Array; /** * Set the auth tag. * @param authTag Set the auth tag. */ setAuthTag(authTag: Uint8Array): void; /** * Calculate the padding amount. * @param len The length to calculate the padding for. * @returns The padding amount. * @internal */ private padLength; /** * Perform a xor test on the two arrays. * @param a The first array. * @param b The second array. * @returns The xor count. * @internal */ private xorTest; }