| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 924670f commit 183bcc0
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,13 +53,10 @@ const { | |||
| 53 | 53 | } = require('internal/errors'); | |
| 54 | 54 | ||
| 55 | 55 | const validateParameters = hideStackFrames((hash, key, salt, info, length) => { | |
| 56 | - key = prepareKey(key); | ||
| 57 | - salt = toBuf(salt); | ||
| 58 | - info = toBuf(info); | ||
| 59 | - | ||
| 60 | 56 | validateString(hash, 'digest'); | |
| 61 | - validateByteSource(salt, 'salt'); | ||
| 62 | - validateByteSource(info, 'info'); | ||
| 57 | + key = prepareKey(key); | ||
| 58 | + salt = validateByteSource(salt, 'salt'); | ||
| 59 | + info = validateByteSource(info, 'info'); | ||
| 63 | 60 | ||
| 64 | 61 | validateInteger(length, 'length', 0, kMaxLength); | |
| 65 | 62 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -271,7 +271,7 @@ const validateByteSource = hideStackFrames((val, name) => { | |||
| 271 | 271 | val = toBuf(val); | |
| 272 | 272 | ||
| 273 | 273 | if (isAnyArrayBuffer(val) || isArrayBufferView(val)) | |
| 274 | - return; | ||
| 274 | + return val; | ||
| 275 | 275 | ||
| 276 | 276 | throw new ERR_INVALID_ARG_TYPE( | |
| 277 | 277 | name, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,11 @@ const { | |||
| 15 | 15 | } = require('crypto'); | |
| 16 | 16 | ||
| 17 | 17 | { | |
| 18 | + assert.throws(() => hkdf(), { | ||
| 19 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 20 | + message: /The "digest" argument must be of type string/ | ||
| 21 | + }); | ||
| 22 | + | ||
| 18 | 23 | [1, {}, [], false, Infinity].forEach((i) => { | |
| 19 | 24 | assert.throws(() => hkdf(i, 'a'), { | |
| 20 | 25 | code: 'ERR_INVALID_ARG_TYPE', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments