floCrypto: errorHanding

errorHanding added to floCrypto.getPubKeyHex and floCrypto.getFloIDfromPubkeyHex
This commit is contained in:
sairajzero 2020-03-04 03:45:50 +05:30
parent 47ca6a802e
commit 8652959e54

View File

@ -7214,7 +7214,7 @@ Bitcoin.Util = {
getPubKeyHex: function (privateKeyHex) {
var key = new Bitcoin.ECKey(privateKeyHex);
if (key.priv == null) {
alert("Invalid Private key");
console.error("Invalid Private key");
return;
}
key.setCompressed(true);
@ -7224,9 +7224,13 @@ Bitcoin.Util = {
//Returns flo-ID from public-key
getFloIDfromPubkeyHex: function (pubkeyHex) {
var key = new Bitcoin.ECKey().setPub(pubkeyHex);
var floID = key.getBitcoinAddress();
return floID;
try{
var key = new Bitcoin.ECKey().setPub(pubkeyHex);
var floID = key.getBitcoinAddress();
return floID;
}catch (e) {
console.error(e);
}
},
//Verify the private-key for the given public-key or flo-ID