diff --git a/package.json b/package.json index 5041db4..698bdc8 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "bigi": "^1.4.2", "bip39": "^2.4.0", "bitcoinforksjs-lib": "git://github.com/bitcoinjs/bitcoinjs-lib#opt-in-bitcoincash-sighash", - "bitcoinjs-lib": "^3.2.0", - "bitcoinjs-lib-zcash": "git://github.com/karel-3d/bitcoinjs-lib#zcash", + "bitcoinjs-lib": "git://github.com/SuperNETorg/bitcoinjs-lib", + "bitcoinjs-lib-zcash": "git://github.com/pbca26/bitcoinjs-lib#zcash", "bitcoinjs-lib-pos": "git://github.com/KomodoPlatform/bitcoinjs-lib-pos", "bluebird": "^3.4.7", "body-parser": "^1.15.2", diff --git a/routes/electrumjs/electrumjs.networks.js b/routes/electrumjs/electrumjs.networks.js index fcb3848..6a8157b 100644 --- a/routes/electrumjs/electrumjs.networks.js +++ b/routes/electrumjs/electrumjs.networks.js @@ -269,4 +269,12 @@ networks.btc = networks.bitcoin; networks.crw = networks.crown; networks.dgb = networks.digibyte; networks.arg = networks.argentum; -networks.zec = networks.zcash; \ No newline at end of file +networks.zec = networks.zcash; +networks.nmc = networks.namecoin; +networks.ltc = networks.litecoin; +networks.vtc = networks.vertcoin; +networks.via = networks.viacoin; +networks.fair = networks.faircoin; +networks.doge = networks.dogecoin; +networks.kmd = networks.komodo; +networks.mona = networks.monacoin; \ No newline at end of file diff --git a/routes/shepherd/electrum/auth.js b/routes/shepherd/electrum/auth.js index 9351529..d7bed0a 100644 --- a/routes/shepherd/electrum/auth.js +++ b/routes/shepherd/electrum/auth.js @@ -1,18 +1,28 @@ +const bs58check = require('bs58check'); +const bitcoinZcash = require('bitcoinjs-lib-zcash'); + module.exports = (shepherd) => { shepherd.post('/electrum/login', (req, res, next) => { for (let key in shepherd.electrumServers) { const _abbr = shepherd.electrumServers[key].abbr; const _seed = req.body.seed; let keys; + let isWif = false; + + console.log(_seed); + + try { + bs58check.decode(_seed); + isWif = true; + } catch (e) {} - if ((_seed.length === 51 || _seed.length === 52) && - _seed.indexOf(' ') === -1 && - _seed.match(/^[a-zA-Z0-9]*$/)) { - let key = shepherd.bitcoinJS.ECPair.fromWIF(_seed, shepherd.electrumJSNetworks.komodo); + if (isWif) { + let key = shepherd.isZcash(_abbr.toLowerCase()) ? bitcoinZcash.ECPair.fromWIF(_seed, shepherd.getNetworkData(_abbr.toLowerCase()), true) : shepherd.bitcoinJS.ECPair.fromWIF(_seed, shepherd.getNetworkData(_abbr.toLowerCase()), true); keys = { priv: key.toWIF(), pub: key.getAddress(), }; + console.log(keys); } else { keys = shepherd.seedToWif(_seed, shepherd.findNetworkObj(_abbr), req.body.iguana); } diff --git a/routes/shepherd/electrum/keys.js b/routes/shepherd/electrum/keys.js index 6c4b3ca..735ab63 100644 --- a/routes/shepherd/electrum/keys.js +++ b/routes/shepherd/electrum/keys.js @@ -38,7 +38,7 @@ module.exports = (shepherd) => { } shepherd.get('/electrum/wiftopub', (req, res, next) => { - let key = shepherd.bitcoinJS.ECPair.fromWIF(req.query.wif, shepherd.electrumJSNetworks[req.query.coin]); + let key = shepherd.isZcash(req.query.coin.toLowerCase()) ? bitcoinZcash.ECPair.fromWIF(req.query.wif, shepherd.electrumJSNetworks[req.query.coin], true) : shepherd.bitcoinJS.ECPair.fromWIF(req.query.wif, shepherd.electrumJSNetworks[req.query.coin], true); keys = { priv: key.toWIF(), pub: key.getAddress(), diff --git a/version b/version index ef2859a..b5c5eda 100644 --- a/version +++ b/version @@ -1,3 +1,3 @@ -version=0.2.0.25i -type=i-beta +version=0.2.0.25j +type=j-beta minversion=0.2.0.2 \ No newline at end of file diff --git a/version_build b/version_build index abb893b..1432935 100644 --- a/version_build +++ b/version_build @@ -1 +1 @@ -0.2.0.25i-beta \ No newline at end of file +0.2.0.25j-beta \ No newline at end of file