-
Notifications
You must be signed in to change notification settings - Fork 161
SubtleCrypto.verify
should return js.Promise[Boolean]
#660
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
Comments
Thanks for writing this up. Another example is def sign(
algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource
): js.Promise[js.Any] = js.native that should return a |
So the spec/idl actually says
TypeScript uses Personally, I think we should type them as TypeScript...but spec is spec :P |
Thanks for looking into that! You're right, good catch.
I guess the fundamental issue is that these methods have to support various cryptography algorithms, including ones that may be introduced in the future. In theory, the "verify operation" for an algorithm could return something that is not a IMHO we should leave this as-is. My opinion is that Scala.js DOM's purpose is to facade according to the spec without getting too tangled up in "usability" concerns (see related discussion in #481). Instead to "fix" these issues the door is open for wrapper libraries to emerge, with idiomatic Scala APIs. e.g. https://github.com/typelevel/bobcats |
Understandable, however there is one actual mistake in the signatures as far as I can see, according to the spec
and in scala-js-dom it's a js.Any:
I can open a PR if you like, should I make a new issue for it? |
@zetashift great, let's fix that one then! |
Reported by @bblfish on Discord.
scala-js-dom/dom/src/main/scala/org/scalajs/dom/SubtleCrypto.scala
Lines 36 to 37 in b20fa78
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify
There may be other signatures that can be improved in the crypto APIs as well.
The text was updated successfully, but these errors were encountered: