From: Chris Duncan Date: Wed, 1 Jul 2026 05:34:12 +0000 (-0700) Subject: Narrow Blake2b input types. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=04612f1705c88b30919c4ddb4fddf5d5f3da8eff;p=libnemo.git Narrow Blake2b input types. --- diff --git a/src/lib/crypto/blake2b.ts b/src/lib/crypto/blake2b.ts index f9a9f07..d4526ac 100644 --- a/src/lib/crypto/blake2b.ts +++ b/src/lib/crypto/blake2b.ts @@ -228,7 +228,7 @@ export class Blake2b { if (length < B.OUTBYTES_MIN || length > B.OUTBYTES_MAX) { throw new RangeError(`length must be ${B.OUTBYTES_MIN}-${B.OUTBYTES_MAX} bytes`) } - if (key != null) { + if (key !== undefined) { if (!(key instanceof Uint8Array)) { throw new TypeError(`key must be Uint8Array or Buffer`) } @@ -236,7 +236,7 @@ export class Blake2b { throw new RangeError(`key must be ${B.KEYBYTES_MIN}-${B.KEYBYTES_MAX} bytes`) } } - if (salt != null) { + if (salt !== undefined) { if (!(salt instanceof Uint8Array)) { throw new TypeError(`salt must be Uint8Array or Buffer`) } @@ -244,7 +244,7 @@ export class Blake2b { throw new RangeError(`salt must be ${B.SALTBYTES} bytes`) } } - if (personal != null) { + if (personal !== undefined) { if (!(personal instanceof Uint8Array)) { throw new TypeError(`personal must be Uint8Array or Buffer`) }