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"
|
- "0.10"
|
||||||
addons:
|
addons:
|
||||||
firefox: "34.0"
|
firefox: "34.0"
|
||||||
|
env:
|
||||||
|
- ECCRYPTO_NO_FALLBACK=1
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never
|
on_success: never
|
||||||
|
|
6
index.js
6
index.js
|
@ -12,10 +12,14 @@ var crypto = require("crypto");
|
||||||
// try to use secp256k1, fallback to browser implementation
|
// try to use secp256k1, fallback to browser implementation
|
||||||
try {
|
try {
|
||||||
var secp256k1 = require("secp256k1");
|
var secp256k1 = require("secp256k1");
|
||||||
|
var ecdh = require("./build/Release/ecdh");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (process.env.ECCRYPTO_NO_FALLBACK) {
|
||||||
|
throw e;
|
||||||
|
} else {
|
||||||
return (module.exports = require("./browser"));
|
return (module.exports = require("./browser"));
|
||||||
}
|
}
|
||||||
var ecdh = require("./build/Release/ecdh");
|
}
|
||||||
|
|
||||||
function assert(condition, message) {
|
function assert(condition, message) {
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user