summaryrefslogtreecommitdiff
path: root/genkey.html
blob: b73f21a70811c5433489254f1fc74823e86282a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>
<head>
  <script src="/encrypt_key.js"></script>
  <script>
    window.sodium = {
      onload: function (sodium) {
        var sodium = sodium;
        update();
      }
    };
    function update() {
      let password = document.getElementById("password").value;
      let key = sodium.crypto_sign_keypair('hex');
      encryptedPrivateKey = encrypt_private_key(password, key.privateKey);
      document.getElementById("output").innerHTML =
         '$privKey = "' + encryptedPrivateKey + '";<br>' +
         '$pubKey = "' + key.publicKey + '";';
    }
  </script>
  <script src="/sodium.js" async></script>
</head>
<body>
<input type="password" id="password" onchange="update();" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();">
<p id="output"></p>
</body>
</html>