From 2985d967372ece3250be6c051d26b83db3f72884 Mon Sep 17 00:00:00 2001 From: raviycoder <135521192+raviycoder@users.noreply.github.com> Date: Sun, 14 Jul 2024 14:26:56 +0530 Subject: [PATCH] validate retreive input for bcs, btc and flo privkeys --- index.html | 83 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/index.html b/index.html index a7e024e..75dc213 100644 --- a/index.html +++ b/index.html @@ -254,7 +254,7 @@

Did you forget your Binance Address?

- If you have your Binance Private Key, enter it here and recover your + If you have your BSC/BTC/FLO Private Key, enter it here and recover your Binance Address.

@@ -266,7 +266,7 @@ const assetIcons = { Binance: ` - - - - - - - - - - - - - - - -`, + viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve"> + + + + + + + + + + + + + + + + `, usdc: ` `, usdt: `tether-usdt-logo`, }; @@ -1072,7 +1072,11 @@ .closest(".contact") .querySelector("sm-copy").value = e.target.value)} > - ${floAddress.startsWith("F")?"FLO":"BTC"} + ${floAddress.startsWith("F") + ? "FLO" + : "BTC"} BSC `} @@ -1158,7 +1162,9 @@ ${floAddress && floAddress !== BSCAddress ? html`
-
${floAddress.startsWith("F")?"FLO":"BTC"} address
+
+ ${floAddress.startsWith("F") ? "FLO" : "BTC"} address +
@@ -1819,7 +1825,13 @@ let bscPrivateKey = getRef("retrieve_btc_addr_field").value.trim(); getRef("recovered_btc_addr_wrapper").classList.remove("hidden"); getRef("recovered_btc_addr").value = - floEthereum.ethAddressFromPrivateKey(bscPrivateKey); + bscPrivateKey.startsWith("R") || + bscPrivateKey.startsWith("L") || + bscPrivateKey.startsWith("K") + ? floEthereum.ethAddressFromPrivateKey( + coinjs.wif2privkey(bscPrivateKey).privkey + ) + : floEthereum.ethAddressFromPrivateKey(bscPrivateKey); } if (document.startViewTransition) { document.startViewTransition(() => { @@ -1827,6 +1839,15 @@ }); } else retrieve(); } + function wif2SolanaAddress(wif) { + var k1, k2, k3, k4, k5; + k1 = coinjs.wif2privkey(wif); + k2 = Crypto.util.hexToBytes(k1.privkey); + k3 = Uint8Array.from(k2); + k4 = solanaWeb3.Keypair.fromSeed(k3); + k5 = k4.publicKey.toString(); + return k5; + }