From a3676745845dd9bd1567ae4a67b0a933b0e293d2 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 4 Feb 2016 03:33:15 -0800 Subject: [PATCH] more keypair stuff. --- lib/bcoin/script.js | 14 -------------- lib/bcoin/wallet.js | 6 +++--- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 75b7a670..643e8928 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -279,8 +279,6 @@ script.getSubscript = function getSubscript(s, lastSep) { }; script.checksig = function checksig(msg, sig, key) { - var k; - if (key.getPublic) key = key.getPublic(); @@ -292,18 +290,6 @@ script.checksig = function checksig(msg, sig, key) { sig = sig.slice(0, -1); - try { - k = bcoin.ecdsa.keyPair({ pub: key }); - } catch (e) { - return false; - } - - // Points at Infinity make verify() throw. - // This specifically throws on wallet-test.js - // where [1] is concatted to the pubkey. - if (k.getPublic().isInfinity()) - return false; - // Use a try catch in case there are // any uncaught errors for bad inputs in verify(). try { diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index da5feb9c..f7b8b53f 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -670,10 +670,10 @@ Wallet.prototype.createKey = function createKey(change, index) { delete this._firstKey; return key; } - key = bcoin.ecdsa.genKeyPair(); + key = bcoin.keypair(); return { - privateKey: key.getPrivate().toArray(), - publicKey: key.getPublic(true, 'array') + privateKey: key.privateKey, + publicKey: key.publicKey }; }