Closed oleiade closed 1 year ago
The specification indicates that certain specific errors such as QuotaExceededError should be returned under certain conditions. At the moment I have defined specific errors the Go way, and I throw them using common.Throw; but that doesn't allow me to, for instance, switch on them in the context of a catch statement, as in:
AFAIK this will require that you actually define this error and then make instances of them.
This PR addresses #19
It adds an implementation for the
crypto.getRandomValues
operation to the extension.The underlying implementation depends on the Go
rand/crypto.Read
method as a PRNG. This standard functionality relies on the underlying OS' pseudo-random number generator, such as/dev/urandom
on Linux.This implementation suffers a few limitations that shouldn't be a deal-breaker, but for which I couldn't find any acceptable workaround at this day:
Int8Array
,Uint8Array
,Int16Array
,Uint16Array
,Int32Array
,Uint32Array
orUInt8ClampedArray
) on the underlyingArrayBuffer
should be accepted. I couldn't figure out how to do that in Goja. I'd be really grateful if you have any idea on that front šš»QuotaExceededError
should be returned under certain conditions. At the moment I have defined specific errors the Go way, and I throw them usingcommon.Throw
; but that doesn't allow me to, for instance,switch
on them in the context of acatch
statement, as in:Let me know what you think šš»