Browse Source

spv uncompressed wif

v0.25
pbca26 7 years ago
parent
commit
6855aefb9f
  1. 11
      routes/shepherd/electrum/auth.js

11
routes/shepherd/electrum/auth.js

@ -2,18 +2,19 @@ module.exports = (shepherd) => {
shepherd.post('/electrum/login', (req, res, next) => { shepherd.post('/electrum/login', (req, res, next) => {
for (let key in shepherd.electrumServers) { for (let key in shepherd.electrumServers) {
const _abbr = shepherd.electrumServers[key].abbr; const _abbr = shepherd.electrumServers[key].abbr;
const _seed = req.body.seed;
let keys; let keys;
if (req.body.seed.length === 52 && if ((_seed.length === 51 || _seed.length === 52) &&
req.body.seed.indexOf(' ') === -1 && _seed.indexOf(' ') === -1 &&
req.body.seed.match(/^[a-zA-Z0-9]*$/)) { _seed.match(/^[a-zA-Z0-9]*$/)) {
let key = shepherd.bitcoinJS.ECPair.fromWIF(req.body.seed, shepherd.electrumJSNetworks.komodo); let key = shepherd.bitcoinJS.ECPair.fromWIF(_seed, shepherd.electrumJSNetworks.komodo);
keys = { keys = {
priv: key.toWIF(), priv: key.toWIF(),
pub: key.getAddress(), pub: key.getAddress(),
}; };
} else { } else {
keys = shepherd.seedToWif(req.body.seed, shepherd.findNetworkObj(_abbr), req.body.iguana, req.body.old); keys = shepherd.seedToWif(_seed, shepherd.findNetworkObj(_abbr), req.body.iguana);
} }
shepherd.electrumKeys[_abbr] = { shepherd.electrumKeys[_abbr] = {

Loading…
Cancel
Save