Halola
1
I tried to import crypto lib but got some errors

inside crypto folder is empty
here is my code
const {subtle} = require('crypto').webcrypto;
//const subtle = require('crypto').webcrypto;
function importRSAKey(keyData, format = 'jwk', hash = 'SHA-1') {
const key = subtle.importKey(format, keyData, {
name: 'RSA-OAEP',
hash
}, false, ['verify']);
return key;
}
keystore = {"kty":"RSA","use":"enc","kid":"03tq2Vt99numAuzBc4LI43kRzuRlhozB","n":"ht5RHidiB8PkWvFuwEdVj6UH6qbWVU95g9pZNxUAm61Bmx0bdzatKNF6w-jQbXYAxDgyT5fTQZr21litcICnLS1_h5AMgPsFu6p_OKr7R0hScVnh49LrSqDQra66moHE-XEOOggu6XMfrs9307dhtDAM24M2DqtA3wv_jP-n13cZhm24jgrgge61JxtThcdsnwTdrv_UAKfAVpDcjesE-ZeJ5H2dMscuIJUTMRyHAYFcSFIajtUoSIsQTFy1GIt8C1OWav6dLYhsX1L0QDaHM_Q9QPDC69mcVhJJDlrCOhuYLVoODENPKPAlNzTGBd2JyZW6_hF3Wx9F5rFrkr7Srw","e":"AQAB"}
const e = {
name: "RSA-OAEP",
hash: {
name: "SHA-1"
}
}
key = importRSAKey("jwk", keystore, e, !1, ["encrypt"])
copy from this : Web Crypto API | Node.js v16.8.0 Documentation
Ruri
2
I think you’re missing npm init before you do npm install
Halola
3
it said crypto is already built-in core
Ruri
4
I think you need to ask @Pure about this, I’m not good with node 
1 Like
Pure
5
crypto.webcrypto was introduced in node v15.0.0.
If you are using the LTS Version from the Node website it is version 14.17.5. It does not include webcrypto.
2 Likes
Halola
6
thanks the problem was solved
I use this lib
Ruri
7
Or you could’ve just updated your node, but maybe that was not an option for you
1 Like
Halola
8
i’ll start update when I’m done with migration
Thanks for your concern