Create xchacha20NonceLength constant

This commit is contained in:
Simon Warta 2020-07-22 09:32:08 +02:00
parent 325a28d8ec
commit 5e3c1cbfba
4 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,7 @@ export {
Xchacha20poly1305IetfKey,
Xchacha20poly1305IetfMessage,
Xchacha20poly1305IetfNonce,
xchacha20NonceLength,
Argon2id,
Argon2idOptions,
Ed25519,

View File

@ -91,6 +91,13 @@ export class Ed25519 {
}
}
/**
* Nonce length in bytes for all flavours of XChaCha20.
*
* @see https://libsodium.gitbook.io/doc/advanced/stream_ciphers/xchacha20#notes
*/
export const xchacha20NonceLength = 24;
export class Xchacha20poly1305Ietf {
public static async encrypt(
message: Xchacha20poly1305IetfMessage,

View File

@ -9,6 +9,7 @@ export {
Xchacha20poly1305IetfKey,
Xchacha20poly1305IetfMessage,
Xchacha20poly1305IetfNonce,
xchacha20NonceLength,
Argon2id,
Argon2idOptions,
Ed25519,

View File

@ -31,6 +31,12 @@ export declare class Ed25519 {
static createSignature(message: Uint8Array, keyPair: Ed25519Keypair): Promise<Uint8Array>;
static verifySignature(signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): Promise<boolean>;
}
/**
* Nonce length in bytes for all flavours of XChaCha20.
*
* @see https://libsodium.gitbook.io/doc/advanced/stream_ciphers/xchacha20#notes
*/
export declare const xchacha20NonceLength = 24;
export declare class Xchacha20poly1305Ietf {
static encrypt(
message: Xchacha20poly1305IetfMessage,