From b1b34a99e6eb9832d94ffc65512172e246e35f6d Mon Sep 17 00:00:00 2001 From: Robert Kieffer Date: Mon, 25 Dec 2017 19:31:37 -0800 Subject: [PATCH] fix: use msCrypto if available. Fixes #241 --- lib/rng-browser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rng-browser.js b/lib/rng-browser.js index aaf40f72..e5868033 100644 --- a/lib/rng-browser.js +++ b/lib/rng-browser.js @@ -3,8 +3,8 @@ // and inconsistent support for the `crypto` API. We do the best we can via // feature-detection -var getRandomValues = typeof(crypto) != 'undefined' && crypto.getRandomValues; - +var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues) || + (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues); if (getRandomValues) { // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef