scala-webapp-template icon indicating copy to clipboard operation
scala-webapp-template copied to clipboard

Remove SecureRandom patch after the upgrade to scala.js to 1.10.0

Open AlexITC opened this issue 2 years ago • 1 comments

Upgrading has some tricky details (https://www.scala-js.org/news/2022/04/04/announcing-scalajs-1.10.0/) because we need to use the secure random library for running the app but the insecure one for tests, this occurs because the test environment doesn't have the crypto modules available.

We need either:

  • A way to replace the secure random with the insecure one for testing.
  • A way to switch our test environment so that it has the crypto modules available.

AlexITC avatar Apr 11 '22 13:04 AlexITC

The problem is that our js transitive dependencies bring https://github.com/crypto-browserify/randomfill/blob/master/browser.js which doesn't seem to allow generating random numbers in our jsdom environment (see).

I ended up adding a minor local patch to https://github.com/scala-js/scala-js-fake-insecure-java-securerandom for solving the problem, it is ideal to eventually get rid of this patch.

AlexITC avatar Apr 15 '22 05:04 AlexITC