From 04612f1705c88b30919c4ddb4fddf5d5f3da8eff Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 30 Jun 2026 22:34:12 -0700 Subject: [PATCH] Narrow Blake2b input types. --- src/lib/crypto/blake2b.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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`) } -- 2.52.0