diff --git a/package.json b/package.json index d335daa..76dc408 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/randombytes.js b/randombytes.js index dc25851..f23eefe 100644 --- a/randombytes.js +++ b/randombytes.js @@ -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 }