-
Notifications
You must be signed in to change notification settings - Fork 3
Initial implementation. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Green CI build here: https://github.com/sjrd/scala-js-java-securerandom/actions/runs/2065025222 |
8e20fee
to
d8ed45c
Compare
README.md
Outdated
|
||
You can then use `java.security.SecureRandom` from your code, and by extension, the `java.util.UUID.randomUUID()` method. | ||
|
||
When running on environments other than browsers or Node.js, attempts to use the above features will throw a `java.lang.UnsupportedOperationException`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat pessimistic. Other runtimes such as Cloudflare Workers (serverless) and Deno have also implemented the WebCrypto APIs.
https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#methods
https://deno.com/blog/v1.11#more-web-crypto-apis-supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Thanks :)
d8ed45c
to
69dc31e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments from scala-js/scala-js-fake-insecure-java-securerandom#1 also apply here.
build.sbt
Outdated
.settings(commonSettings: _*) | ||
.settings( | ||
testOptions += Tests.Argument(TestFramework("com.novocode.junit.JUnitFramework"), "-v", "-a"), | ||
buildInfoKeys := Seq(BuildInfoKey("expectFailure" -> (jsEnvKind.value == JSEnvKind.JSDOMNodeJS))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider passing in the raw info so the logic if why we expect a failure remains encapsulated in the relevant test.
lazy val testSuite = crossProject(JSPlatform, JVMPlatform) | ||
.in(file("test-suite")) | ||
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) | ||
.enablePlugins(BuildInfoPlugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: We should use this for the core repo as well. Right now, we roll our own :)
test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/security/SecureRandomTest.scala
Show resolved
Hide resolved
project/plugins.sbt
Outdated
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") | ||
|
||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") | ||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 0.11.0?
b5f62dc
to
1bd1795
Compare
I think I have addressed all the comments here as well, now. |
1bd1795
to
d6cf1c8
Compare
Upgraded to Scala.js 1.10.0 final. |
Goes together with scala-js/scala-js#4659
Draft because the CI script mentions my fork of scala-js/scala-js. We'll need it to change that once scala-js/scala-js#4659 is merged.
But otherwise it's ready to review.