1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 02:25:14 -07:00

If browser crypto is not available, try msCrypto before assuming a

Node environment
This commit is contained in:
Deirdre Connolly 2015-06-08 14:22:39 -04:00
parent f46439c1e2
commit f2afab4b1b

View File

@ -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);