0

From the great answer here I took the example to try to use node-forge with prng in my Angular test project.

In one of my prior tests with Angular and node-forge I have used the following function:

pki.rsa.generateKeyPair({ bits: 4096, workers: -1 }, (err, keypair) => {...}

without problem, but as soon as add prng from the answer

   seed = 'My test seed phrase';
   const prng = random.createInstance();
   prng.seedFileSync = () => seed;
   const { privateKey, publicKey } = pki.rsa.generateKeyPair({ bits: 4096, prng, workers: 2 })

I am getting the 404 error (using ng serve command). forge/prime.worker.js 404 (Not Found) I have been using node-forge for a couple of times without any problems and now I have no idea how to fix this.

I have tried cloning the forge project and compiled it by myself - same result. I have tried to add prime.worker.js to angular.json (does not sound wise, but I have tired).

I expect node-forge to generate a keypair using my seed.

GCJohn
  • 1
  • 1

0 Answers0