compressed option added to brain wallet

This commit is contained in:
pointbiz 2016-02-13 17:28:42 -04:00
parent f64e8cd85d
commit c97bac03bb
4 changed files with 17 additions and 2 deletions

View file

@ -6476,6 +6476,7 @@ input[type=checkbox] { position: relative; z-index: 20; }
#bulkarea .format { font-style: italic; font-size: 90%; } #bulkarea .format { font-style: italic; font-size: 90%; }
#bulktextarea { font-size: 90%; width: 98%; margin: 4px 0 0 0; } #bulktextarea { font-size: 90%; width: 98%; margin: 4px 0 0 0; }
#brainarea .keyarea { visibility: hidden; min-height: 110px; } #brainarea .keyarea { visibility: hidden; min-height: 110px; }
#brainview { margin-left: 5px; }
#detailkeyarea { padding: 10px; } #detailkeyarea { padding: 10px; }
#detailarea { margin: 0; text-align: left; } #detailarea { margin: 0; text-align: left; }
#detailarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; } #detailarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; }
@ -6784,9 +6785,13 @@ input[type=checkbox] { position: relative; z-index: 20; }
<div class="row extra"> <div class="row extra">
<span class="label" id="brainlabelconfirm"><label for="brainpassphraseconfirm">Confirm Passphrase: </label></span> <span class="label" id="brainlabelconfirm"><label for="brainpassphraseconfirm">Confirm Passphrase: </label></span>
<input tabindex="2" type="password" id="brainpassphraseconfirm" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" /> <input tabindex="2" type="password" id="brainpassphraseconfirm" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" />
<span><input tabindex="3" type="button" id="brainview" value="View" onclick="ninja.wallets.brainwallet.view();" /></span>
<span id="brainalgorithm" class="notes right">Algorithm: SHA256(passphrase)</span> <span id="brainalgorithm" class="notes right">Algorithm: SHA256(passphrase)</span>
</div> </div>
<div class ="row extra">
<span><label tabindex="3" id="brainlabelcompressed" for="braincompressed">Compressed address?</label> <input type="checkbox" id="braincompressed" /></span>
<span><input tabindex="4" type="button" id="brainview" value="View" onclick="ninja.wallets.brainwallet.view();" /></span>
</div>
<div class="row extra"><span id="brainwarning"></span></div> <div class="row extra"><span id="brainwarning"></span></div>
</div> </div>
<div id="brainkeyarea" class="keyarea"> <div id="brainkeyarea" class="keyarea">
@ -10221,6 +10226,9 @@ ninja.wallets.brainwallet = {
if (key.length >= ninja.wallets.brainwallet.minPassphraseLength) { if (key.length >= ninja.wallets.brainwallet.minPassphraseLength) {
var bytes = Crypto.SHA256(key, { asBytes: true }); var bytes = Crypto.SHA256(key, { asBytes: true });
var btcKey = new Bitcoin.ECKey(bytes); var btcKey = new Bitcoin.ECKey(bytes);
var isCompressed = document.getElementById("braincompressed").checked;
console.log(isCompressed);
btcKey.setCompressed(isCompressed);
var bitcoinAddress = btcKey.getBitcoinAddress(); var bitcoinAddress = btcKey.getBitcoinAddress();
var privWif = btcKey.getBitcoinWalletImportFormat(); var privWif = btcKey.getBitcoinWalletImportFormat();
document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress; document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress;

View file

@ -269,9 +269,13 @@
<div class="row extra"> <div class="row extra">
<span class="label" id="brainlabelconfirm"><label for="brainpassphraseconfirm">Confirm Passphrase: </label></span> <span class="label" id="brainlabelconfirm"><label for="brainpassphraseconfirm">Confirm Passphrase: </label></span>
<input tabindex="2" type="password" id="brainpassphraseconfirm" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" /> <input tabindex="2" type="password" id="brainpassphraseconfirm" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" />
<span><input tabindex="3" type="button" id="brainview" value="View" onclick="ninja.wallets.brainwallet.view();" /></span>
<span id="brainalgorithm" class="notes right">Algorithm: SHA256(passphrase)</span> <span id="brainalgorithm" class="notes right">Algorithm: SHA256(passphrase)</span>
</div> </div>
<div class ="row extra">
<span><label tabindex="3" id="brainlabelcompressed" for="braincompressed">Compressed address?</label> <input type="checkbox" id="braincompressed" /></span>
<span><input tabindex="4" type="button" id="brainview" value="View" onclick="ninja.wallets.brainwallet.view();" /></span>
</div>
<div class="row extra"><span id="brainwarning"></span></div> <div class="row extra"><span id="brainwarning"></span></div>
</div> </div>
<div id="brainkeyarea" class="keyarea"> <div id="brainkeyarea" class="keyarea">

View file

@ -92,6 +92,7 @@ input[type=checkbox] { position: relative; z-index: 20; }
#bulkarea .format { font-style: italic; font-size: 90%; } #bulkarea .format { font-style: italic; font-size: 90%; }
#bulktextarea { font-size: 90%; width: 98%; margin: 4px 0 0 0; } #bulktextarea { font-size: 90%; width: 98%; margin: 4px 0 0 0; }
#brainarea .keyarea { visibility: hidden; min-height: 110px; } #brainarea .keyarea { visibility: hidden; min-height: 110px; }
#brainview { margin-left: 5px; }
#detailkeyarea { padding: 10px; } #detailkeyarea { padding: 10px; }
#detailarea { margin: 0; text-align: left; } #detailarea { margin: 0; text-align: left; }
#detailarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; } #detailarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; }

View file

@ -26,6 +26,8 @@ ninja.wallets.brainwallet = {
if (key.length >= ninja.wallets.brainwallet.minPassphraseLength) { if (key.length >= ninja.wallets.brainwallet.minPassphraseLength) {
var bytes = Crypto.SHA256(key, { asBytes: true }); var bytes = Crypto.SHA256(key, { asBytes: true });
var btcKey = new Bitcoin.ECKey(bytes); var btcKey = new Bitcoin.ECKey(bytes);
var isCompressed = document.getElementById("braincompressed").checked;
btcKey.setCompressed(isCompressed);
var bitcoinAddress = btcKey.getBitcoinAddress(); var bitcoinAddress = btcKey.getBitcoinAddress();
var privWif = btcKey.getBitcoinWalletImportFormat(); var privWif = btcKey.getBitcoinWalletImportFormat();
document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress; document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress;