ignore crypto in the browser

This commit is contained in:
Mathias Buus 2017-11-19 13:16:13 +01:00
parent b1741bfdae
commit 48081c6896
2 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,9 @@
"browserify": "^14.1.0",
"sodium-test": "^0.7.0"
},
"browser": {
"crypto": false
},
"scripts": {
"browser": "browserify test.js | browser-run",
"browser-manual": "browserify test.js | browser-run -p 1234",

View File

@ -21,7 +21,7 @@ var randombytes = (function () {
return browserBytes
} else if (typeof require !== 'undefined') {
// Node.js.
crypto = require('cry' + 'pto');
crypto = require('crypto')
if (crypto && crypto.randomBytes) {
return nodeBytes
}