mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-26 11:47:13 +09:00
If browser crypto is not available, try msCrypto before assuming a
Node environment
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user