Skip to content

crypto: diffieHellman throw error on invalid object

const crypto = require('crypto')
crypto.diffieHellman(null)

Before:

node:internal/crypto/diffiehellman:297
  const { privateKey, publicKey } = options;
          ^

TypeError: Cannot destructure property 'privateKey' of 'options' as it is null.
    at Object.diffieHellman (node:internal/crypto/diffiehellman:297:11)

After:

TypeError [ERR_INVALID_ARG_TYPE]: The "options" argument must be of type object. Received null
      at Object.diffieHellman (node:internal/crypto/diffiehellman:293:3)

Merge request reports

Loading