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