You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a slight difference here in that getRandomValues as currently specified in WebCrypto must be invoked with a receiver which is a crypto object: (0, crypto.getRandomValues)(new Uint8Array()) fails.
Note that the receiver just needs to be acrypto object:
The fact that crypto works this way is pretty unfortunate and, as I understand it, is just an accident of history: I'm pretty sure it's because crypto was specified before namespaces were introduced to WebIDL, which was done specifically to make (0, console.log)() work (done here). But it is what it is.
I don't believe this to be a web compatibility issue, however. Not throwing an error shouldn't make any existing code break today, though it would be worthwhile to discuss this more with someone directly involved with the WebCrypto spec about maintaining compatibility.
There's a slight difference here in that
getRandomValues
as currently specified in WebCrypto must be invoked with a receiver which is acrypto
object:(0, crypto.getRandomValues)(new Uint8Array())
fails.Note that the receiver just needs to be a
crypto
object:works.
The fact that
crypto
works this way is pretty unfortunate and, as I understand it, is just an accident of history: I'm pretty sure it's becausecrypto
was specified before namespaces were introduced to WebIDL, which was done specifically to make(0, console.log)()
work (done here). But it is what it is.Originally posted by @bakkot in #2 (comment)
The text was updated successfully, but these errors were encountered: