title: jwt token with encrypted private key and passphrase
body: <p>I am tring to generate jwt token with below code</p>
  <pre><code>const { join } = require(&quot;path&quot;);
  const { readFileSync } = require(&quot;fs&quot;);
  const PRIVATE_KEY_PATH = join(__dirname, &quot;./keys/private.pem&quot;);
  
  const jws = require(&quot;jws&quot;);
  const ALG = &quot;PS256&quot;;
  
  const privateKey = {
      key: readFileSync(PRIVATE_KEY_PATH, &quot;utf8&quot;).toString(),
      passphrase: &quot;Passphrasehere&quot;,
  };
  const payload = {
      foo: &quot;bar&quot;,
  };
  
  const token = jws.sign({
      header: { alg: ALG },
      payload,
      privateKey,
  });
  </code></pre>
  <p>But it showing error -</p>
  <p>TypeError [ERR_INVALID_ARG_TYPE]: <strong>The &quot;key.key&quot; property must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received an instance of Object at prepareAsymmetricKey (internal/crypto/keys.js:288:13)</strong></p>