mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 10:37:24 -07:00
If browser crypto
is not available, try msCrypto
before assuming a
Node environment
This commit is contained in:
parent
f46439c1e2
commit
f2afab4b1b
@ -60,7 +60,8 @@ randombytes_stir(void)
|
||||
EM_ASM({
|
||||
if (Module.getRandomValue === undefined) {
|
||||
try {
|
||||
var crypto_ = ("object" === typeof window ? window : self).crypto,
|
||||
var window_ = "object" === typeof window ? window : self,
|
||||
crypto_ = typeof window_.crypto !== "undefined" ? window_.crypto : window_.msCrypto,
|
||||
randomValuesStandard = function() {
|
||||
var buf = new Uint32Array(1);
|
||||
crypto_.getRandomValues(buf);
|
||||
|
Loading…
Reference in New Issue
Block a user