Skip to content

Commit

Permalink
Generate QRCode for private keys
Browse files Browse the repository at this point in the history
Add button to mnemonic seed,
Generate QRCode for seed, view and spend key
  • Loading branch information
jenniferberger authored and moneromooo-monero committed Mar 19, 2021
1 parent ddc0840 commit 1c5335d
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions monero-wallet-generator.html
Original file line number Diff line number Diff line change
Expand Up @@ -11021,14 +11021,18 @@ <h4 style="color: #555;">Offline wallet generator</h4>
<div class="col s12">
<div class="card pink lighten-5">
<div class="card-content pink-text text-darken-5">
<span class="card-title pink-text text-darken-5">Mnemonic seed</span>
<span class="card-title pink-text text-darken-5">Mnemonic seed
<input type="button" class="waves-effect waves-light btn" onclick="js:toggle_priv_qr();" value="Show QR code" action=""
style="line-height: 25px; height: 25px; font-size: 60%; padding: 0px 1.5rem;"/ id="show_priv_qr_code"></span>
</span>
<p>
The mnemonic seed is a string that comprises 25 words and allows you to recreate your
private keys. <b>Keep it secure!</b>
</p>
</div>
<div class="card-action center-align">
<h5 class="grey-text text-darken-4" id="mnemonic_widget">Generating... </h5>
<span class="qrcode" id="priv_qr_widget" onclick="js:toggle_priv_qr();"></span>
</div>
</div>
</div>
Expand Down Expand Up @@ -11064,9 +11068,8 @@ <h5 class="grey-text text-darken-4" id="mnemonic_widget">Generating... </h5>
</div>
</div>



<div class="row">&nbsp;</div>

<footer class="page-footer grey lighten-3 grey-text text-darken-4">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -11202,6 +11205,7 @@ <h5>Checking a git commit's signature</h5>
view_key_widget = document.getElementById("view_key_widget");
address_widget = document.getElementById("address_widget");
address_qr_widget = document.getElementById("address_qr_widget");
priv_qr_widget = document.getElementById("priv_qr_widget");
mnemonic_widget = document.getElementById("mnemonic_widget");
user_entropy_widget = document.getElementById("user_entropy_widget")

Expand All @@ -11224,15 +11228,19 @@ <h5>Checking a git commit's signature</h5>
view_key_widget.innerHTML = keys.view.sec;
address_widget.innerHTML = cnUtil.pubkeys_to_string(keys.spend.pub, keys.view.pub);
address_qr_widget.innerHTML = "";
priv_qr_widget.innerHTML = "";
mnemonic_widget.innerHTML = mnemonic;

// only monero has the URI scheme
if (prefix_widget.value == "4") {
qr=new QRCode(address_qr_widget, {correctLevel:QRCode.CorrectLevel.L});
qr.makeCode("monero:"+keys.public_addr);
qr_priv=new QRCode(priv_qr_widget, {correctLevel:QRCode.CorrectLevel.L});
qr_priv.makeCode("monero:"+keys.public_addr+"&p_v_key="+keys.view.sec+"&p_s_key="+keys.spend.sec+"&p_seed="+mnemonic);
}
else {
qr = null;
qr_priv = null;
}
}

Expand Down Expand Up @@ -11264,16 +11272,21 @@ <h5>Checking a git commit's signature</h5>
spend_key_widget = document.getElementById("spend_key_widget");
view_key_widget = document.getElementById("view_key_widget");
address_widget = document.getElementById("address_widget");
address_qr_widget = document.getElementById("address_qr_widget");
priv_qr_widget = document.getElementById("priv_qr_widget");
mnemonic_widget = document.getElementById("mnemonic_widget");

spend_key_widget.innerHTML = keys.spend.sec;
view_key_widget.innerHTML = keys.view.sec;
address_widget.innerHTML = keys.public_addr;
address_qr_widget.innerHTML = "";
priv_qr_widget.innerHTML = "";
mnemonic_widget.innerHTML = mnemonic;

qr=new QRCode(address_qr_widget, {correctLevel:QRCode.CorrectLevel.L});
qr.makeCode("monero:"+keys.public_addr);
qr_priv=new QRCode(priv_qr_widget, {correctLevel:QRCode.CorrectLevel.L});
qr_priv.makeCode("monero:"+keys.public_addr+"&p_v_key="+keys.view.sec+"&p_s_key="+keys.spend.sec+"&p_seed="+mnemonic);
}

var zerohex="0000000000000000000000000000000000000000000000000000000000000000";
Expand Down Expand Up @@ -11382,17 +11395,43 @@ <h5>Checking a git commit's signature</h5>
function toggle_qr()
{
address_qr_widget = document.getElementById("address_qr_widget");
priv_qr_widget = document.getElementById("priv_qr_widget");
spend_key_widget = document.getElementById("spend_key_widget");
view_key_widget = document.getElementById("view_key_widget");
mnemonic_widget = document.getElementById("mnemonic_widget");
if (address_qr_widget.style.display=="block") {
address_qr_widget.style.display="none";
priv_qr_widget.style.display="none";
spend_key_widget.style.display = "block";
view_key_widget.style.display = "block";
mnemonic_widget.style.display = "block";
}
else {
address_qr_widget.style.display="block";
priv_qr_widget.style.display="none";
spend_key_widget.style.display = "none";
view_key_widget.style.display = "none";
mnemonic_widget.style.display = "none";
}
}

function toggle_priv_qr()
{
address_qr_widget = document.getElementById("address_qr_widget");
priv_qr_widget = document.getElementById("priv_qr_widget");
spend_key_widget = document.getElementById("spend_key_widget");
view_key_widget = document.getElementById("view_key_widget");
mnemonic_widget = document.getElementById("mnemonic_widget");
if (priv_qr_widget.style.display=="block") {
address_qr_widget.style.display="none";
priv_qr_widget.style.display="none";
spend_key_widget.style.display = "block";
view_key_widget.style.display = "block";
mnemonic_widget.style.display = "block";
}
else {
address_qr_widget.style.display="none";
priv_qr_widget.style.display="block";
spend_key_widget.style.display = "none";
view_key_widget.style.display = "none";
mnemonic_widget.style.display = "none";
Expand Down Expand Up @@ -11445,6 +11484,7 @@ <h5>Checking a git commit's signature</h5>
enableLanguage("jp", enable)
enableLanguage("eo", enable)
enableElement("show_qr_code", enable)
enableElement("show_priv_qr_code", enable)
}

var oldSelectionIndex = false;
Expand Down

0 comments on commit 1c5335d

Please sign in to comment.