You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I've noticed that the newest version (1.4.1) doesn't work on pre-16 Node versions. That's the error:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received an instance of ArrayBuffer
at new NodeError (internal/errors.js:322:7)
at prepareSecretKey (internal/crypto/keys.js:322:11)
at new Hmac (internal/crypto/hash.js:111:9)
at Object.createHmac (crypto.js:146:10)
at zCe (/var/task/index.js:104:39810)
at Object.Vlt [as createLMv2Response] (/var/task/index.js:104:39953)
at Object.Klt (/var/task/index.js:104:43424)
at /var/task/index.js:104:48437
at p (/var/task/index.js:104:47086)
at Object.next (/var/task/index.js:104:46369)
I've decided to dig a little and I think I know why it happens now. Basically, js-md4 buffer method (which has been deprecated btw) that is used to create a hash used as a key for HMAC returns an ArrayBuffer. The thing is - ArrayBuffer support in crypto's createHmac has been added in Node v16.
Hey,
I've noticed that the newest version (1.4.1) doesn't work on pre-16 Node versions. That's the error:
I've decided to dig a little and I think I know why it happens now. Basically, js-md4 buffer method (which has been deprecated btw) that is used to create a hash used as a key for HMAC returns an ArrayBuffer. The thing is - ArrayBuffer support in crypto's createHmac has been added in Node v16.
Create a hash and pass it to createLMv2Response
Util used for hash generation - uses js-md4 buffer that returns ArrayBuffer
MD4 hash passed down
The ArrayBuffer hash being passed to crypto.createHmac and breaking pre-16 Node versions
The text was updated successfully, but these errors were encountered: