From a7a37fc3efe6b0e306c0e3eeb11d514eb0dfcc89 Mon Sep 17 00:00:00 2001 From: Kyle Honeycutt Date: Fri, 24 Apr 2020 17:32:18 -0700 Subject: [PATCH] Fix brainCreate A commit in February broke the brain wallet feature, https://github.com/coinables/segwitaddress/commit/779ce46a42b500152316fd4d1d582019a55335a0 --- index.html | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 10f8b89..b241a10 100644 --- a/index.html +++ b/index.html @@ -167,10 +167,12 @@ - - - + + + + + @@ -414,24 +416,31 @@

Details

//fetch user input var brainInput = $("#brainWalletInput").val(); //create a key pair based on the sha256 hash of the users input - me.addMouseEntropy(brainInput, currentNetwork(), function(maddr, mpk){ - document.getElementById("swaddr").innerHTML = "

Segwit Address

" + maddr + "
"; + var checkNet = currentNetwork(); + isTestNet = null; + if(checkNet == bitcoin.networks.testnet){ + isTestNet = "testnet"; + console.log("testnet"); + } + var brainPair = buidl.createFrom(brainInput, isTestNet); + + document.getElementById("swaddr").innerHTML = "

Segwit Address

" + brainPair.p2shp2wpkh + "
"; - //blank out any existing qr code - document.getElementById("qrcode").innerHTML = ""; - //create new qrcode with segwit address - new QRCode(document.getElementById("qrcode"), maddr); + //blank out any existing qr code + document.getElementById("qrcode").innerHTML = ""; + //create new qrcode with segwit address + new QRCode(document.getElementById("qrcode"), brainPair.p2shp2wpkh); - document.getElementById("swpk").innerHTML = "

Segwit Private Key

" + mpk + "
"; + document.getElementById("swpk").innerHTML = "

Segwit Private Key

" + brainPair.pk + "
"; - //blank out any exisitng private key qr code - document.getElementById("qrcodepk").innerHTML = ""; - //create new qrcode with private key - new QRCode(document.getElementById("qrcodepk"), mpk); + //blank out any exisitng private key qr code + document.getElementById("qrcodepk").innerHTML = ""; + //create new qrcode with private key + new QRCode(document.getElementById("qrcodepk"), brainPair.pk); - //zero out brain wallet input - brainInput = ""; - }); + //zero out brain wallet input + brainInput = ""; + } function details(){