diff --git a/bitaddress.org.html b/bitaddress.org.html index 70ce57a..326984b 100644 --- a/bitaddress.org.html +++ b/bitaddress.org.html @@ -6321,16 +6321,15 @@
-
- -
+
+
- +
@@ -7490,17 +7489,17 @@ document.getElementById("splitarea").style.display = "none"; }, - mkOutputRow: function(s,n) { + mkOutputRow: function(s,id,lbltxt) { var row = document.createElement("span"); var label = document.createElement("label"); - label.innerHTML="Share " + (n+1); - var txt = document.createElement("input"); - txt.setAttribute("readOnly", true); - txt.setAttribute("value", s); - txt.setAttribute("size", 60); + label.innerHTML= lbltxt + s; + var qr = document.createElement("div"); + + qr.setAttribute("id", id); row.appendChild(label); - row.appendChild(txt); + row.appendChild(qr); row.appendChild(document.createElement("br")); + return row; }, @@ -7510,24 +7509,32 @@ // Split a private key and update information in the HTML splitKey: function () { try { + var key = new Bitcoin.ECKey(false); + var bitcoinAddress = key.getBitcoinAddress(); var element = document.getElementById("splitoutput"); if (element != null) element.parentNode.removeChild(element); - var privkeyBase58 = document.getElementById('splitprivkey').value; var numshares = parseInt(document.getElementById('splitshares').value); var threshhold = parseInt(document.getElementById('splitthreshhold').value); //alert(numshares) //alert(threshhold) - var shares = secrets.share(Crypto.util.bytesToHex(Bitcoin.Base58.decode(privkeyBase58)), + var shares = secrets.share(Crypto.util.bytesToHex(key.getBitcoinPrivateKeyByteArray()), numshares, threshhold).map(Crypto.util.hexToBytes).map(Bitcoin.Base58.encode); //alert(shares); var output = document.createElement("div"); output.setAttribute("id", "splitoutput"); + var m = {}; + output.appendChild(this.mkOutputRow(bitcoinAddress, "split_addr", "Bitcoin Address: ")); + m["split_addr"] = bitcoinAddress; + for (var i=0; i < shares.length; i++) { - output.appendChild(this.mkOutputRow(shares[i], i)); + var id = "split_qr_"+ i; + output.appendChild(this.mkOutputRow(shares[i], id, "Share " + (i+1) + ": ")); + m[id]=shares[i]; } document.getElementById("splitcommands").appendChild(output); + ninja.qrCode.showQrCode(m); } catch (e) { @@ -7552,7 +7559,7 @@ map(Crypto.util.bytesToHex). map(this.stripLeadZeros)); - var privkeyBase58 = Bitcoin.Base58.encode(Crypto.util.hexToBytes(combined)); + var privkeyBase58 = new Bitcoin.ECKey(Crypto.util.hexToBytes(combined)).getBitcoinWalletImportFormat(); var output = document.createElement("div"); output.setAttribute("id", "combineoutput"); var txt = document.createElement("input");