import keypair from 'keypair';
const pair = keypair();
现状:
core.mjs:11754 ERROR TypeError: crypto.randomBytes is not a function
at ctx.seedFileSync (index.js:1032:21)
at _reseedSync (index.js:921:21)
at ctx.generateSync (index.js:874:9)
at ctx.generate (index.js:801:18)
at forge.random.getBytes (index.js:1831:23)
at Object.nextBytes (index.js:1858:28)
at BigInteger.bnpFromNumber [as fromNumber] (index.js:2552:4)
at new BigInteger (index.js:1898:35)
at pki.rsa.stepKeyPairGenerationState (index.js:3972:21)
at pki.rsa.generateKeyPair (index.js:4322:13)
问题:
keypire使用报错
测试步骤:
现状:
core.mjs:11754 ERROR TypeError: crypto.randomBytes is not a function at ctx.seedFileSync (index.js:1032:21) at _reseedSync (index.js:921:21) at ctx.generateSync (index.js:874:9) at ctx.generate (index.js:801:18) at forge.random.getBytes (index.js:1831:23) at Object.nextBytes (index.js:1858:28) at BigInteger.bnpFromNumber [as fromNumber] (index.js:2552:4) at new BigInteger (index.js:1898:35) at pki.rsa.stepKeyPairGenerationState (index.js:3972:21) at pki.rsa.generateKeyPair (index.js:4322:13)
版本信息:
v1.0.4
期望:
成功