diff --git a/browser/empty.js b/browser/empty.js index 0da8625c..5df3feef 100644 --- a/browser/empty.js +++ b/browser/empty.js @@ -1,2 +1,2 @@ // Empty module for browserify. -exports.empty = true; +exports.unsupported = true; diff --git a/lib/crypto/crypto.js b/lib/crypto/crypto.js index 9b13a840..2394ad78 100644 --- a/lib/crypto/crypto.js +++ b/lib/crypto/crypto.js @@ -14,7 +14,7 @@ var utils = require('../utils/utils'); var co = require('../utils/co'); var native = require('../utils/native').binding; var backend = require('./backend'); -var lazy = require('../utils/lazy')(require, exports); +var lazy = utils.lazy(require, exports); /** * @exports crypto diff --git a/lib/crypto/ec-elliptic.js b/lib/crypto/ec-elliptic.js index 26af627f..76e941a6 100644 --- a/lib/crypto/ec-elliptic.js +++ b/lib/crypto/ec-elliptic.js @@ -11,7 +11,7 @@ var assert = require('assert'); var elliptic = require('elliptic'); var secp256k1 = elliptic.ec('secp256k1'); var Signature = require('elliptic/lib/elliptic/ec/signature'); -var curve = elliptic.curve; +var curve = secp256k1.curve; var BN = require('bn.js'); /** diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 61a77a33..74cc8540 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -1946,6 +1946,9 @@ utils.U32 = function U32(num) { utils.lazy = require('./lazy'); +if (utils.lazy.unsupported) + utils.lazy = function() { return utils.nop; }; + /* * Expose other objects. */ diff --git a/package.json b/package.json index cb3f5399..b2da1eaa 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "./lib/http/server": "./browser/empty.js", "./lib/http/wallet": "./browser/empty.js", "./lib/utils/lazy": "./browser/empty.js", - "./lib/crypto/native": "./lib/crypto/empty.js", + "./lib/utils/native": "./browser/empty.js", "./lib/utils/nfkd": "./lib/utils/nfkd-browser.js", "./lib/utils/nexttick": "./lib/utils/nexttick-browser.js", "./lib/crypto/backend": "./lib/crypto/backend-browser.js",