move ecdh load into try{}; add fallback override env var
This commit is contained in:
parent
365674f622
commit
3922b1b4ab
|
@ -3,6 +3,8 @@ node_js:
|
|||
- "0.10"
|
||||
addons:
|
||||
firefox: "34.0"
|
||||
env:
|
||||
- ECCRYPTO_NO_FALLBACK=1
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
|
8
index.js
8
index.js
|
@ -12,10 +12,14 @@ var crypto = require("crypto");
|
|||
// try to use secp256k1, fallback to browser implementation
|
||||
try {
|
||||
var secp256k1 = require("secp256k1");
|
||||
var ecdh = require("./build/Release/ecdh");
|
||||
} catch (e) {
|
||||
return (module.exports = require("./browser"));
|
||||
if (process.env.ECCRYPTO_NO_FALLBACK) {
|
||||
throw e;
|
||||
} else {
|
||||
return (module.exports = require("./browser"));
|
||||
}
|
||||
}
|
||||
var ecdh = require("./build/Release/ecdh");
|
||||
|
||||
function assert(condition, message) {
|
||||
if (!condition) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user