From 8798e7046f0e09a61d57d2db78b536a796859f61 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 22 Jul 2020 11:23:20 +0200 Subject: [PATCH] Add documentation to Argon2idOptions --- packages/crypto/src/libsodium.ts | 17 +++++++++++++---- packages/crypto/types/libsodium.d.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/packages/crypto/src/libsodium.ts b/packages/crypto/src/libsodium.ts index 5f425fba..a68274cc 100644 --- a/packages/crypto/src/libsodium.ts +++ b/packages/crypto/src/libsodium.ts @@ -6,12 +6,21 @@ import sodium from "libsodium-wrappers"; export interface Argon2idOptions { - // in bytes + /** Output length in bytes */ readonly outputLength: number; - // integer between 1 and 4294967295 + /** + * An integer between 1 and 4294967295 representing the computational difficulty. + * + * @see https://libsodium.gitbook.io/doc/password_hashing/default_phf#key-derivation + */ readonly opsLimit: number; - // memory limit measured in KiB (like argon2 command line tool) - // Note: only ~ 16 MiB of memory are available using the non-sumo version of libsodium + /** + * Memory limit measured in KiB (like argon2 command line tool) + * + * Note: only approximately 16 MiB of memory are available using the non-sumo version of libsodium.js + * + * @see https://libsodium.gitbook.io/doc/password_hashing/default_phf#key-derivation + */ readonly memLimitKib: number; } diff --git a/packages/crypto/types/libsodium.d.ts b/packages/crypto/types/libsodium.d.ts index 6ecd5ce7..00437296 100644 --- a/packages/crypto/types/libsodium.d.ts +++ b/packages/crypto/types/libsodium.d.ts @@ -1,6 +1,19 @@ export interface Argon2idOptions { + /** Output length in bytes */ readonly outputLength: number; + /** + * An integer between 1 and 4294967295 representing the computational difficulty. + * + * @see https://libsodium.gitbook.io/doc/password_hashing/default_phf#key-derivation + */ readonly opsLimit: number; + /** + * Memory limit measured in KiB (like argon2 command line tool) + * + * Note: only approximately 16 MiB of memory are available using the non-sumo version of libsodium.js + * + * @see https://libsodium.gitbook.io/doc/password_hashing/default_phf#key-derivation + */ readonly memLimitKib: number; } export declare class Argon2id {