]> git.codecow.com Git - libnemo.git/commitdiff
Narrow Blake2b input types.
authorChris Duncan <chris@codecow.com>
Wed, 1 Jul 2026 05:34:12 +0000 (22:34 -0700)
committerChris Duncan <chris@codecow.com>
Wed, 1 Jul 2026 05:34:12 +0000 (22:34 -0700)
src/lib/crypto/blake2b.ts

index f9a9f074c891f0cdde968764217202a4a51ee8c6..d4526ace80a4e78d079f9a7929236ed611b8b111 100644 (file)
@@ -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`)
                        }