mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-01 22:46:00 +00:00
+4
-4
@@ -13,7 +13,7 @@ f.close()
|
|||||||
|
|
||||||
# Script tags
|
# Script tags
|
||||||
|
|
||||||
scriptsFinder = re.compile("""<script src="/(.*)"></script>""")
|
scriptsFinder = re.compile("""<script src="(.*)"></script>""")
|
||||||
scripts = scriptsFinder.findall(page)
|
scripts = scriptsFinder.findall(page)
|
||||||
|
|
||||||
for script in scripts:
|
for script in scripts:
|
||||||
@@ -21,13 +21,13 @@ for script in scripts:
|
|||||||
s = open(filename)
|
s = open(filename)
|
||||||
scriptContent = "<script>%s</script>" % s.read()
|
scriptContent = "<script>%s</script>" % s.read()
|
||||||
s.close()
|
s.close()
|
||||||
scriptTag = """<script src="/%s"></script>""" % script
|
scriptTag = """<script src="%s"></script>""" % script
|
||||||
page = page.replace(scriptTag, scriptContent)
|
page = page.replace(scriptTag, scriptContent)
|
||||||
|
|
||||||
|
|
||||||
# Style tags
|
# Style tags
|
||||||
|
|
||||||
stylesFinder = re.compile("""<link rel="stylesheet" href="/(.*)">""")
|
stylesFinder = re.compile("""<link rel="stylesheet" href="(.*)">""")
|
||||||
styles = stylesFinder.findall(page)
|
styles = stylesFinder.findall(page)
|
||||||
|
|
||||||
for style in styles:
|
for style in styles:
|
||||||
@@ -35,7 +35,7 @@ for style in styles:
|
|||||||
s = open(filename)
|
s = open(filename)
|
||||||
styleContent = "<style>%s</style>" % s.read()
|
styleContent = "<style>%s</style>" % s.read()
|
||||||
s.close()
|
s.close()
|
||||||
styleTag = """<link rel="stylesheet" href="/%s">""" % style
|
styleTag = """<link rel="stylesheet" href="%s">""" % style
|
||||||
page = page.replace(styleTag, styleContent)
|
page = page.replace(styleTag, styleContent)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-9
@@ -3,7 +3,7 @@
|
|||||||
<head lang="en">
|
<head lang="en">
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>BIP39 - Mnemonic Code</title>
|
<title>BIP39 - Mnemonic Code</title>
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||||
<meta content="Mnemonic code for generating deterministic keys" name="description"/>
|
<meta content="Mnemonic code for generating deterministic keys" name="description"/>
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
<meta content="bitcoin mnemonic converter" name="description" />
|
<meta content="bitcoin mnemonic converter" name="description" />
|
||||||
@@ -88,6 +88,12 @@
|
|||||||
<textarea id="passphrase" class="passphrase form-control"></textarea>
|
<textarea id="passphrase" class="passphrase form-control"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="seed" class="col-sm-2 control-label">BIP39 Seed</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<textarea id="seed" class="seed form-control" readonly="readonly"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="network-phrase" class="col-sm-2 control-label">Coin</label>
|
<label for="network-phrase" class="col-sm-2 control-label">Coin</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
@@ -385,13 +391,13 @@
|
|||||||
<td class="privkey"><span></span></td>
|
<td class="privkey"><span></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/jquery.min.js"></script>
|
<script src="js/jquery.min.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="js/bootstrap.min.js"></script>
|
||||||
<script src="/js/bitcoinjs-1-5-7.js"></script>
|
<script src="js/bitcoinjs-1-5-7.js"></script>
|
||||||
<script src="/js/bitcoinjs-extensions.js"></script>
|
<script src="js/bitcoinjs-extensions.js"></script>
|
||||||
<script src="/js/sjcl-bip39.js"></script>
|
<script src="js/sjcl-bip39.js"></script>
|
||||||
<script src="/js/wordlist_english.js"></script>
|
<script src="js/wordlist_english.js"></script>
|
||||||
<script src="/js/jsbip39.js"></script>
|
<script src="js/jsbip39.js"></script>
|
||||||
<script src="/js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var mnemonic = new Mnemonic("english");
|
var mnemonic = new Mnemonic("english");
|
||||||
|
var seed = null
|
||||||
var bip32RootKey = null;
|
var bip32RootKey = null;
|
||||||
var bip32ExtendedKey = null;
|
var bip32ExtendedKey = null;
|
||||||
var network = bitcoin.networks.bitcoin;
|
var network = bitcoin.networks.bitcoin;
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
DOM.phrase = $(".phrase");
|
DOM.phrase = $(".phrase");
|
||||||
DOM.passphrase = $(".passphrase");
|
DOM.passphrase = $(".passphrase");
|
||||||
DOM.generate = $(".generate");
|
DOM.generate = $(".generate");
|
||||||
|
DOM.seed = $(".seed");
|
||||||
DOM.rootKey = $(".root-key");
|
DOM.rootKey = $(".root-key");
|
||||||
DOM.extendedPrivKey = $(".extended-priv-key");
|
DOM.extendedPrivKey = $(".extended-priv-key");
|
||||||
DOM.extendedPubKey = $(".extended-pub-key");
|
DOM.extendedPubKey = $(".extended-pub-key");
|
||||||
@@ -169,7 +171,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calcBip32Seed(phrase, passphrase, path) {
|
function calcBip32Seed(phrase, passphrase, path) {
|
||||||
var seed = mnemonic.toSeed(phrase, passphrase);
|
seed = mnemonic.toSeed(phrase, passphrase);
|
||||||
bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network);
|
bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network);
|
||||||
bip32ExtendedKey = bip32RootKey;
|
bip32ExtendedKey = bip32RootKey;
|
||||||
// Derive the key from the path
|
// Derive the key from the path
|
||||||
@@ -232,6 +234,7 @@
|
|||||||
|
|
||||||
function displayBip32Info() {
|
function displayBip32Info() {
|
||||||
// Display the key
|
// Display the key
|
||||||
|
DOM.seed.val(seed);
|
||||||
var rootKey = bip32RootKey.toBase58();
|
var rootKey = bip32RootKey.toBase58();
|
||||||
DOM.rootKey.val(rootKey);
|
DOM.rootKey.val(rootKey);
|
||||||
var extendedPrivKey = bip32ExtendedKey.toBase58();
|
var extendedPrivKey = bip32ExtendedKey.toBase58();
|
||||||
|
|||||||
Reference in New Issue
Block a user