diff options
-rw-r--r-- | compile.py | 8 | ||||
-rw-r--r-- | src/index.html | 24 | ||||
-rw-r--r-- | src/js/index.js | 5 |
3 files changed, 23 insertions, 14 deletions
@@ -13,7 +13,7 @@ f.close() | |||
13 | 13 | ||
14 | # Script tags | 14 | # Script tags |
15 | 15 | ||
16 | scriptsFinder = re.compile("""<script src="/(.*)"></script>""") | 16 | scriptsFinder = re.compile("""<script src="(.*)"></script>""") |
17 | scripts = scriptsFinder.findall(page) | 17 | scripts = scriptsFinder.findall(page) |
18 | 18 | ||
19 | for script in scripts: | 19 | for script in scripts: |
@@ -21,13 +21,13 @@ for script in scripts: | |||
21 | s = open(filename) | 21 | s = open(filename) |
22 | scriptContent = "<script>%s</script>" % s.read() | 22 | scriptContent = "<script>%s</script>" % s.read() |
23 | s.close() | 23 | s.close() |
24 | scriptTag = """<script src="/%s"></script>""" % script | 24 | scriptTag = """<script src="%s"></script>""" % script |
25 | page = page.replace(scriptTag, scriptContent) | 25 | page = page.replace(scriptTag, scriptContent) |
26 | 26 | ||
27 | 27 | ||
28 | # Style tags | 28 | # Style tags |
29 | 29 | ||
30 | stylesFinder = re.compile("""<link rel="stylesheet" href="/(.*)">""") | 30 | stylesFinder = re.compile("""<link rel="stylesheet" href="(.*)">""") |
31 | styles = stylesFinder.findall(page) | 31 | styles = stylesFinder.findall(page) |
32 | 32 | ||
33 | for style in styles: | 33 | for style in styles: |
@@ -35,7 +35,7 @@ for style in styles: | |||
35 | s = open(filename) | 35 | s = open(filename) |
36 | styleContent = "<style>%s</style>" % s.read() | 36 | styleContent = "<style>%s</style>" % s.read() |
37 | s.close() | 37 | s.close() |
38 | styleTag = """<link rel="stylesheet" href="/%s">""" % style | 38 | styleTag = """<link rel="stylesheet" href="%s">""" % style |
39 | page = page.replace(styleTag, styleContent) | 39 | page = page.replace(styleTag, styleContent) |
40 | 40 | ||
41 | 41 | ||
diff --git a/src/index.html b/src/index.html index 1699b39..16d93e6 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -3,7 +3,7 @@ | |||
3 | <head lang="en"> | 3 | <head lang="en"> |
4 | <meta charset="utf-8" /> | 4 | <meta charset="utf-8" /> |
5 | <title>BIP39 - Mnemonic Code</title> | 5 | <title>BIP39 - Mnemonic Code</title> |
6 | <link rel="stylesheet" href="/css/bootstrap.min.css"> | 6 | <link rel="stylesheet" href="css/bootstrap.min.css"> |
7 | <meta content="Mnemonic code for generating deterministic keys" name="description"/> | 7 | <meta content="Mnemonic code for generating deterministic keys" name="description"/> |
8 | <meta content="width=device-width, initial-scale=1.0" name="viewport" /> | 8 | <meta content="width=device-width, initial-scale=1.0" name="viewport" /> |
9 | <meta content="bitcoin mnemonic converter" name="description" /> | 9 | <meta content="bitcoin mnemonic converter" name="description" /> |
@@ -89,6 +89,12 @@ | |||
89 | </div> | 89 | </div> |
90 | </div> | 90 | </div> |
91 | <div class="form-group"> | 91 | <div class="form-group"> |
92 | <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label> | ||
93 | <div class="col-sm-10"> | ||
94 | <textarea id="seed" class="seed form-control" readonly="readonly"></textarea> | ||
95 | </div> | ||
96 | </div> | ||
97 | <div class="form-group"> | ||
92 | <label for="network-phrase" class="col-sm-2 control-label">Coin</label> | 98 | <label for="network-phrase" class="col-sm-2 control-label">Coin</label> |
93 | <div class="col-sm-10"> | 99 | <div class="col-sm-10"> |
94 | <select id="network-phrase" class="network form-control"> | 100 | <select id="network-phrase" class="network form-control"> |
@@ -385,13 +391,13 @@ | |||
385 | <td class="privkey"><span></span></td> | 391 | <td class="privkey"><span></span></td> |
386 | </tr> | 392 | </tr> |
387 | </script> | 393 | </script> |
388 | <script src="/js/jquery.min.js"></script> | 394 | <script src="js/jquery.min.js"></script> |
389 | <script src="/js/bootstrap.min.js"></script> | 395 | <script src="js/bootstrap.min.js"></script> |
390 | <script src="/js/bitcoinjs-1-5-7.js"></script> | 396 | <script src="js/bitcoinjs-1-5-7.js"></script> |
391 | <script src="/js/bitcoinjs-extensions.js"></script> | 397 | <script src="js/bitcoinjs-extensions.js"></script> |
392 | <script src="/js/sjcl-bip39.js"></script> | 398 | <script src="js/sjcl-bip39.js"></script> |
393 | <script src="/js/wordlist_english.js"></script> | 399 | <script src="js/wordlist_english.js"></script> |
394 | <script src="/js/jsbip39.js"></script> | 400 | <script src="js/jsbip39.js"></script> |
395 | <script src="/js/index.js"></script> | 401 | <script src="js/index.js"></script> |
396 | </body> | 402 | </body> |
397 | </html> | 403 | </html> |
diff --git a/src/js/index.js b/src/js/index.js index 9dabe95..4f1ab24 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1,6 +1,7 @@ | |||
1 | (function() { | 1 | (function() { |
2 | 2 | ||
3 | var mnemonic = new Mnemonic("english"); | 3 | var mnemonic = new Mnemonic("english"); |
4 | var seed = null | ||
4 | var bip32RootKey = null; | 5 | var bip32RootKey = null; |
5 | var bip32ExtendedKey = null; | 6 | var bip32ExtendedKey = null; |
6 | var network = bitcoin.networks.bitcoin; | 7 | var network = bitcoin.networks.bitcoin; |
@@ -18,6 +19,7 @@ | |||
18 | DOM.phrase = $(".phrase"); | 19 | DOM.phrase = $(".phrase"); |
19 | DOM.passphrase = $(".passphrase"); | 20 | DOM.passphrase = $(".passphrase"); |
20 | DOM.generate = $(".generate"); | 21 | DOM.generate = $(".generate"); |
22 | DOM.seed = $(".seed"); | ||
21 | DOM.rootKey = $(".root-key"); | 23 | DOM.rootKey = $(".root-key"); |
22 | DOM.extendedPrivKey = $(".extended-priv-key"); | 24 | DOM.extendedPrivKey = $(".extended-priv-key"); |
23 | DOM.extendedPubKey = $(".extended-pub-key"); | 25 | DOM.extendedPubKey = $(".extended-pub-key"); |
@@ -169,7 +171,7 @@ | |||
169 | } | 171 | } |
170 | 172 | ||
171 | function calcBip32Seed(phrase, passphrase, path) { | 173 | function calcBip32Seed(phrase, passphrase, path) { |
172 | var seed = mnemonic.toSeed(phrase, passphrase); | 174 | seed = mnemonic.toSeed(phrase, passphrase); |
173 | bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network); | 175 | bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network); |
174 | bip32ExtendedKey = bip32RootKey; | 176 | bip32ExtendedKey = bip32RootKey; |
175 | // Derive the key from the path | 177 | // Derive the key from the path |
@@ -232,6 +234,7 @@ | |||
232 | 234 | ||
233 | function displayBip32Info() { | 235 | function displayBip32Info() { |
234 | // Display the key | 236 | // Display the key |
237 | DOM.seed.val(seed); | ||
235 | var rootKey = bip32RootKey.toBase58(); | 238 | var rootKey = bip32RootKey.toBase58(); |
236 | DOM.rootKey.val(rootKey); | 239 | DOM.rootKey.val(rootKey); |
237 | var extendedPrivKey = bip32ExtendedKey.toBase58(); | 240 | var extendedPrivKey = bip32ExtendedKey.toBase58(); |