Skip to content

Commit

Permalink
fix(random-bytes): fallback to insecure path if require is null
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 23, 2018
1 parent c210a69 commit 963b12b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/parser/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomVal
} catch (e) {
// keep the fallback
}

// NOTE: in transpiled cases the above require might return null/undefined
if (randomBytes == null) {
randomBytes = insecureRandomBytes;
}
}

module.exports = {
Expand Down

0 comments on commit 963b12b

Please sign in to comment.