From 9b7dd8214d489cc0eb9c7c8ae0780df49789319f Mon Sep 17 00:00:00 2001 From: sairajzero Date: Tue, 25 Aug 2020 18:03:12 +0530 Subject: [PATCH] bug fix - Fixed: Invalid private key on signing in error not working correctly and cause other bugs --- standard_Operations.html | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/standard_Operations.html b/standard_Operations.html index eee91e9..8e9b0a3 100644 --- a/standard_Operations.html +++ b/standard_Operations.html @@ -7234,7 +7234,7 @@ Bitcoin.Util = { var floID = key.getBitcoinAddress(); return floID; } catch (e) { - console.error(e); + return null; } }, @@ -8957,16 +8957,15 @@ Bitcoin.Util = { } else { var privKey; inputFn("PRIVATE_KEY").then(result => { - try { - if (!result) - return reject("Empty Private Key") - var floID = floCrypto.getFloIDfromPubkeyHex( - floCrypto.getPubKeyHex(result)) - privKey = result - } catch (error) { - console.error(error) + if (!result) + return reject("Empty Private Key") + var pubKey = floCrypto.getPubKeyHex(result) + if(!pubKey) return reject("Invalid Private Key") - } + var floID = floCrypto.getFloIDfromPubkeyHex(pubKey) + if(!floID || !floCrypto.validateAddr(floID)) + return reject("Invalid Private Key") + privKey = result; }).catch(error => { console.log(error, "Generating Random Keys") privKey = floCrypto.generateNewID().privKey