Skip to main content

Class: ChaCha20Poly1305

Implementation of the ChaCha20Poly1305 cipher.

Table of contents

Methods

Methods

encryptor

Static encryptor(key, nonce): ChaCha20Poly1305

Create a ChaCha20Poly1305 encryptor.

Parameters

NameTypeDescription
keyUint8ArrayThe key.
nonceUint8ArrayThe nonce.

Returns

ChaCha20Poly1305

Encryptor instance of ChaCha20Poly1305.


decryptor

Static decryptor(key, nonce): ChaCha20Poly1305

Create a ChaCha20Poly1305 decryptor.

Parameters

NameTypeDescription
keyUint8ArrayThe key.
nonceUint8ArrayThe nonce.

Returns

ChaCha20Poly1305

Decryptor instance of ChaCha20Poly1305.


setAAD

setAAD(aad): void

Set the AAD.

Parameters

NameTypeDescription
aadUint8ArrayThe aad to set.

Returns

void


update

update(input): Uint8Array

Update the cipher with more data.

Parameters

NameTypeDescription
inputUint8ArrayThe input data to include.

Returns

Uint8Array

The updated data.


final

final(): void

Finalise the data.

Returns

void


getAuthTag

getAuthTag(): Uint8Array

Get the auth tag.

Returns

Uint8Array

The auth tag.


setAuthTag

setAuthTag(authTag): void

Set the auth tag.

Parameters

NameTypeDescription
authTagUint8ArraySet the auth tag.

Returns

void