'Node and Crypto: this[D].init is not a function?
I am learning NodeJS and trying to import and use a method from the crypto
package.
However, right out of the gate, I get the following error:
TypeError: this[D].init is not a function at new Sign (https://node-1xewvx.w.staticblitz.com/blitz.f2b430413f5697306be55fc5c653053509a24007.js:6:1135208) at createSign (https://node-1xewvx.w.staticblitz.com/blitz.f2b430413f5697306be55fc5c653053509a24007.js:6:808197)
Sandbox demo: https://stackblitz.com/edit/node-1xewvx?file=index.js
My code is:
index.js
:
const { createSign } = require('crypto');
const data = 'this data must be signed';
/// SIGN
const signer = createSign('rsa-sha256');
console.log(signer);
Can someone set me on the right foot and tell me why I get the above error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|