-
Notifications
You must be signed in to change notification settings - Fork 3
/
bip39-chooser.html
771 lines (672 loc) · 26.4 KB
/
bip39-chooser.html
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="jcalfee" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="BIP39 creator / chooser">
<title>bip39-chooser</title>
<link href="src/bip39-chooser.css" rel="stylesheet" type="text/css"/>
<script src="lib/coinExports.js"></script>
<script src="lib/QRious.js"></script><!-- qr -->
<script src="lib/randomBytes.js"></script>
<script>var bip39Checker = coinExports.bip39Checker</script>
<script>var bip39 = bip39Checker.bip39</script>
<script>var Buffer = coinExports.safeBuffer.Buffer</script>
<script>var createHash = coinExports.createHash</script>
<script>var HDKey = coinExports.HDKey</script>
<script>var secp256k1 = coinExports.secp256k1</script>
<script>var base58 = coinExports.base58</script>
<script>
const checkSumWordCount = 1
let bitStrength, totalWordCount, language
function init(lang, wordCount) {
language = lang
const wordCountIdx = [12, 15, 18, 21, 24].indexOf(wordCount)
if(wordCountIdx === -1) {
throw new Error('Invalid word count: ' + wordCount)
}
bitStrength = (wordCount * 11) - (4 + wordCountIdx)
if([128, 160, 192, 224, 256].indexOf(bitStrength) === -1) {
// 128 <= bitStrength <= 256
throw new Error('Invalid bit strength: ' + bitStrength)
}
totalWordCount = wordCount // Math.ceil(bitStrength / 11)
}
</script>
<script>
/** @return {number} random 11 bit number (between 0 and 2047) */
function randomWordPosition() {
if(bip39.wordlists[language].length !== Math.pow(2, 11)) {
throw new Error('Expecting 2048 words per bip39 spec, instead got ' + bip39.wordlists[language].length)
}
rndBytes = randomBytes(2)
i = rndBytes[0] << 3
return i |= rndBytes[1] & 0x7
}
</script>
<script>
function appendTrTd(tr, el) {
const td = document.createElement('td');
td.appendChild(el)
tr.appendChild(td)
return td
}
function createEl(elName, el) {
if(typeof el !== 'object') {
el = document.createTextNode(el == null ? '' : el)
}
const parentEl = document.createElement(elName);
parentEl.appendChild(el)
return parentEl
}
</script>
<script>
function createChooserTable() {
const tbl = document.createElement('table');
const tbdy = document.createElement('tbody');
let tr, appendTd = el => appendTrTd(tr, el)
// drop-down omitting words used in the checksum
function createDropdown() {
const sel = document.createElement('select');
let startPos = randomWordPosition()
for(var i = 0; i < 2048; i++) {
const opt = document.createElement('option')
const pos = (i + startPos) % 2048
opt.value = pos
opt.text = bip39.wordlists[language][pos]
sel.appendChild(opt)
}
return sel
}
var leftCount = 1, rightCount = Math.ceil(totalWordCount / 2) + 1
// 2 column table (one iteration 2 words)
for (var i = 0; i < Math.ceil(totalWordCount / 2); i++) {
tr = document.createElement('tr');
var id = leftCount++
appendTd(createEl('small', id))
var wl = createDropdown()
wl.id = 'Word' + id
wl.className += ' mnemonic-word'
appendTd(wl)
id = rightCount++
if(id < totalWordCount) {
appendTd(createEl('small', id))
wl = createDropdown()
wl.id = 'Word' + id
wl.className += ' mnemonic-word'
appendTd(wl)
} else if(id === totalWordCount) {
const span = document.createElement('span')
appendTd(document.createTextNode(''))
var btn = document.createElement('button')
btn.id = 'submitPhrase'
btn.appendChild(document.createTextNode('✔'))
span.appendChild(btn)
const lbl = createEl('label', 'I\'m Finished!') // onSubmitPhrase
lbl.setAttribute('for', 'submitPhrase')
span.appendChild(createEl('span', ' '))
span.appendChild(createEl('small', lbl))
appendTd(span)
}
tbdy.appendChild(tr);
}
tbl.appendChild(tbdy);
return tbl
}
function lpad (str, padString, length) {
while (str.length < length) str = padString + str
return str
}
function createValidMnemonic() {
let entropyBits = []
for(let i = 1; i < totalWordCount; i ++) { // 1 .. totalWordCount (less checksum word)
const wordIdx = document.getElementById('Word' + i).value
const bits = lpad(Number(wordIdx).toString(2), '0', 11)
entropyBits.push(bits)
}
const additionalEntropy = bitStrength - (totalWordCount - checkSumWordCount) * 11
if(additionalEntropy) {
if(additionalEntropy > 8) {
throw new Error('Additional required entropy is unexpectedly high')
}
// console.log('additionalEntropy', additionalEntropy);
const rndByte = randomBytes(1)[0]
const bits = rndByte.toString(2).substring(0, additionalEntropy)
entropyBits.push(bits)
}
var entropyBytes = entropyBits.join('')
.match(/(.{1,8})/g).map(bin => parseInt(bin, 2))
var entropy = Buffer.from(entropyBytes)
// console.log(entropy.toString('hex'));
return bip39.entropyToMnemonic(entropy, bip39.wordlists[language])
}
</script>
<script>
function onclickSelect(id) {
return function() {
if (document.selection) { // Non-standard
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(id));
range.select();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(document.getElementById(id));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
}
}
// Phrase Display
function clearPhraseDisplay() {
const phraseDisplay = document.getElementById('phraseDisplay')
if(phraseDisplay) {
while(phraseDisplay.firstChild !== null) {
phraseDisplay.removeChild(phraseDisplay.firstChild)
}
}
}
// Phrase Display
function createPhraseDisplay(phrase, element) {
const words = phrase.split(' ')
const div = document.createElement('div');
div.id = 'phraseDisplay'
const tbl = document.createElement('table');
const tbdy = document.createElement('tbody');
tbl.className = 'row'
let tr, appendTd = el => appendTrTd(tr, el)
var leftCount = 1, rightCount = Math.ceil(totalWordCount / 2) + 1
// 2 column table (one iteration 2 words)
for (var i = 0; i < Math.ceil(totalWordCount / 2); i++) {
tr = document.createElement('tr')
var id = leftCount++
appendTd(createEl('small', id))
let wrd = createEl('div', words[id - 1])
wrd.className += ' mnemonic-word'
appendTd(wrd)
id = rightCount++
if(words.length >= id) {
appendTd(createEl('small', id))
wrd = createEl('div', words[id - 1])
wrd.className += 'mnemonic-word'
appendTd(wrd)
}
tbdy.appendChild(tr);
}
tbl.appendChild(tbdy);
div.appendChild(tbl);
const fullPhrase = createEl('span', phrase)
fullPhrase.id = 'fullPhrase'
fullPhrase.className = 'CopyText row'
fullPhrase.onclick = onclickSelect('fullPhrase')
div.appendChild(createEl('p', fullPhrase))
return div
}
function resetState(initial = false) {
if(initial) {
document.getElementById('greetings').style = 'display: block'
document.getElementById('settingsForm').style = 'display: block'
document.getElementById('greetingsInfo').style = 'display: none'
} else {
document.getElementById('greetings').style = 'display: none'
}
document.getElementById('instructions').style = 'display: none'
}
const historyPopState = []
// history
function historyPush(state = undefined, title = "", url = "", popCallback) {
if(window && window['history'] !== undefined) {
if(popCallback) {
historyPopState.push(popCallback)
}
history.pushState(state, title, url)
}
}
// history
if(window) {
window.onpopstate = function() {
const fn = historyPopState.pop()
if(fn) {
fn()
}
}
}
</script>
</head>
<body>
<header class="container">
<h4>BIP39 Mnemonic Key</h4>
</header>
<main class="container">
<script>
function onLoad(lang = 'english', wordCount = 24) {
init(lang, wordCount)
// clearChooserTable
const parentChooser = document.getElementById('mnemonicPhraseChooser')
while(parentChooser.firstChild !== null) {
parentChooser.removeChild(parentChooser.firstChild)
}
// clearChooserTable
const parentTable = document.getElementById('mnemonicPhraseTable')
while(parentTable.firstChild !== null) {
parentTable.removeChild(parentTable.firstChild)
}
const child = createChooserTable()
parentChooser.appendChild(child)
// document.getElementById('Word1').focus()
}
</script>
<form onSubmit="onSubmitPhrase(); return false">
<script>
function clearPhraseChooser() {
// remove prior screen
const parentChooser = document.getElementById('mnemonicPhraseChooser');
while(parentChooser.firstChild !== null) {
parentChooser.removeChild(parentChooser.firstChild);
}
}
function onSubmitPhrase(e) {
// catch all errors to prevent form submit of sensitive information
try {
const mnemonic = createValidMnemonic()
if(!bip39.validateMnemonic(mnemonic, bip39.wordlists[language])) {
throw new Error('invalid mnemonic')
}
const parentDisplay = document.getElementById('mnemonicPhraseTable');
const childDisplay = createPhraseDisplay(mnemonic)
const backupMsg = createEl('h5', 'This is your Private Mnemonic Key Phrase, keep it secret.')
backupMsg.style = 'color: lightcoral'
childDisplay.appendChild(backupMsg)
if(window && window['history'] !== undefined) {
const back = createEl('button', '↞ Back')
back.onclick = function() {
history.back()
const passphrase = document.getElementById('validatePhrase')
passphrase.value = mnemonic
}
childDisplay.appendChild(back)
}
// remove prior screen
clearPhraseChooser()
// remove prior screen
document.getElementById('instructions').style = 'display: none'
parentDisplay.appendChild(childDisplay)
} catch(e){
console.error(e)
}
}
</script>
<div id="mnemonicPhraseChooser"></div>
</form>
<div id="mnemonicPhraseTable"></div>
<div id="greetings">
<br/>
<h4>New Phrase</h4>
<form onSubmit="onSubmitSettings(); return false" id="settingsForm">
<script>
function onSubmitSettings() {
try {
const lang = document.getElementById('language')
const wordCount = document.getElementById('wordCount')
onLoad(lang.value, Number(wordCount.value))
document.getElementById('settingsForm').style = 'display: none'
resetState()
document.getElementById('instructions').style = 'display: block';
historyPush(undefined, 'New Phrase', null, function() {
resetState(true)
clearPhraseChooser()
const phraseEl = document.getElementById('fullPhrase')
if(phraseEl && phraseEl.innerText) {
const phrase = phraseEl.innerText
const validatePhraseEl = document.getElementById('validatePhrase')
validatePhraseEl.innerText = phrase
onValidatePhrase()
}
clearPhraseDisplay()
})
} catch(e){
console.error(e)
}
}
function toggleDisplay(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
</script>
<table>
<tbody>
<tr>
<td>
<label for="language">Language</label>
</td>
<td>
<div class="input-field col s12">
<select id="language">
<option value="english" selected>English</option>
<option value="spanish">Spanish</option>
<option value="korean">Korean</option>
<option value="japanese">Japanese</option>
<option value="italian">Italian</option>
<option value="french">French</option>
<option value="chinese_traditional">Chinese Traditional</option>
<option value="chinese_simplified">Chinese Simplified</option>
</select>
</div>
</td>
</tr>
<tr>
<td>
<label for="language">Word Count</label>
</td>
<td>
<select id="wordCount">
<option value="12" selected>12</option>
<option value="15">15</option>
<option value="18">18</option>
<option value="21">21</option>
<option value="24">24</option>
</select>
</td>
</tr>
</tbody>
</table>
<br/>
<button id="submitSettings" onClick="onSubmitSettings(true); return false">✔</button>
<small><label for="submitSettings">Submit</label></small>
<br />
</form>
<br/>
<div id="greetingsInfo">
<h5>About</h5>
<p><b>New Phrase</b> generates a secure random mnemonic phrase that you may then
personally modify. This page calculates the last word
programmatically so you'll have a valid Bip39 phrase.
</p>
<p>Your personal word selections on the next screen are used to:
</p>
<ul>
<li>Guarentee a flawed or malicious random number generator was not used.</li>
<li>Check the mnemonic phrase restore on your chosen wallet prior to using.</li>
</ul>
<!-- <span style="_float: left">
<a onclick="toggleDisplay('greetingsInfo')" title="Greetings!" id="greetingsMore">[+]</a>
</span> -->
<h6>For Additional Security</h6>
<div> <!-- style="display: none" -->
<ul>
<li>Turn off the Internet connection now and while creating your phrase.</li>
<li>Open this page in a Private Browsing Window. Private Browsing will disable web plug-ins storage (also called: Private Tab, New Private Window, New Incognito Window).</li>
<li>Use the browser's <u>Save Page As…</u> feature to save an immutable or off-line version of this tool (remember to refresh the page first).</li>
<li>Create a hardware wallet (<a href="https://busy.org/trezor/@furion/build-yourself-a-trezor">guide</a>)</li>
</ul>
</div>
</div>
<br/><hr />
<h4>Existing Phrase</h4>
<form onSubmit="return false" id="validateForm">
<script>
let timer
function onValidatePhrase() {
clearTimeout(timer)
const validateAnswer = document.getElementById('validateAnswer')
if(!/Invalid word count/.test(validateAnswer.innerHTML)) {
validateAnswer.innerHTML = ' '
}
timer = setTimeout(function () {
try {
const phrase = document.getElementById('validatePhrase')
const words = phrase.value.trim().split(/ +/)
const endsInSpace = / $/.test(phrase.value)
const invalidWordCount = [12, 15, 18, 21, 24].indexOf(words.length) === -1
let suggestionText = [], isValid = false
if(!endsInSpace && invalidWordCount) { // !endsInSpace allows for spellchecking while typing in phrase
suggestionText.push('Invalid word count')
} else {
const language = document.getElementById('language').value
isValid = bip39.validateMnemonic(phrase.value, bip39.wordlists[language])
if(!isValid) {
for(let i = 0; i < words.length; i++) {
const word = words[i]
const suggestions = bip39Checker.suggest(word, {language})
if(Array.isArray(suggestions) && suggestions.length > 0) {
suggestionText.push(`Word ${i + 1} suggestions: ${suggestions.slice(0, 4).join(', ')}`)
break
}
}
if(!invalidWordCount) {
if(bip39Checker.normalize(phrase.value) !== phrase.value) {
suggestionText.push('Invalid: characters or extraneous spaces or case')
}
if(suggestionText.length === 0) {
suggestionText.push('Incorrect or out of place words')
}
}
}
}
const validateAnswer = document.getElementById('validateAnswer')
validateAnswer.innerHTML = isValid ?
'<div style="color: green">✓ Valid</div>' :
`<div style="color: darkred">${suggestionText.length ? ' ' : ' '}${suggestionText.join(', ')}</div>`
const validatePhraseUnlock = document.getElementById('validatePhraseUnlock')
validatePhraseUnlock.disabled = !isValid
} catch(e){
console.error(e)
}
}, 200)
}
function onValidatePhraseUnlock() {
resetState()
const phrase = document.getElementById('validatePhrase').value.trim()
const passphrase = document.getElementById('passphrase')
showBip32(phrase, passphrase ? passphrase.value.trim() : undefined)
historyPush(undefined, 'Existing Phrase', null, function() {
resetState(true)
clearBip32(phrase)
})
}
</script>
<h5><div id="validateAnswer"/> </h5>
<textarea id="validatePhrase"
placeholder="Paste or type a Bip39 Mnemonic Phrase to check it" autocomplete="off"
onpaste="onValidatePhrase()" onkeydown="onValidatePhrase()"
rows="3" cols="50" __style="width: 100%"></textarea>
<br/>
<div>
<button id="validatePhraseUnlock" disabled onclick="onValidatePhraseUnlock()">Unlock</button>
<input type="text" id="passphrase" placeholder="Passphrase (optional)" autocomplete="off"/>
</div>
</form>
<br/>
<h4>About the Mnemonic Phrase</h4>
<p>
The <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">BIP39 Mnemonic phrase</a>
is a widely used standard for encoding a private seed used to access private
keys on various blockchains or cryptographic networks.
The Mnemonic phrase makes a good user-managed private key because it provides:
<ul>
<li>Words that are not simular</li>
<li>Self checking, you can be warned if any word is out of place</li>
<li>A short dictionary for spellchecking or auto-complete</li>
</ul>
</p>
<h4>Checksum</h4>
<p>The last word is chosen by an algorithm designed to validate the
entire phrase.</p>
<h4>Deterministic Phrases</h4>
<p>Accepting a generated mnemonic phrase is a bad idea if the random
number generator can not be fully audited and understood. A bug or
exploit in the random number generator could allow a 3rd party to
calculate all private mnemonic phrases created by the the device or
code in question. This is a hard to detect remote attack. Detection
of this attack may require reverse engineering code, analyzing
micro-chip circuitry, or observing that other users are get hacked.
</p>
</div>
<div id="instructions" style="display: none">
<h5>Click "<b>I'm Finished!</b>" to generate the <u>last word</u></h5>
<h4>Instructions</h4>
<ul>
<li>Change each drop-down to a new word (make it random).</li>
<li>In the drop-down, the words should be in alphabetical order but each
list should start in a random position.</li>
<li>Observe the final words chosen then click on the submit button (check
icon). The next view should keep all your prior chosen words and add
one additional word as the last word in the phrase.</li>
<li>Carefully backup the phrase. For the written backup, write on a hard-surface.</li>
<li>Use the new phrase soon in the desired tool like a hardware wallet to restore the phrase.</li>
</ul>
<h4>About the drop-downs</h4>
<ul>
<li>Each drop down contains the same 2048 words.</li>
<li>Drop downs are positioned randomly using a secure random number generator.</li>
<li>Drop downs are only created if a secure random number generator is available.</li>
<li>They may be slow but you don't have to do this often.</li>
</ul>
</div>
<div id="showBip32" style="display: none">
<script>
/**
@arg {Buffer} keyBuffer data
@arg {string} keyType = sha256x2, K1, etc
@return {string} checksum encoded base58 string
*/
function checkEncode(keyBuffer, keyType = null) {
if(!Buffer.isBuffer(keyBuffer))
throw new Error('expecting keyBuffer<Buffer>')
if(keyType === 'sha256x2') { // legacy
const checksum = createHash('sha256').update(
createHash('sha256').update(keyBuffer).digest()
).digest().slice(0, 4)
return base58.encode(Buffer.concat([keyBuffer, checksum]))
} else {
const check = [keyBuffer]
if(keyType) {
check.push(Buffer.from(keyType))
}
const checksum = createHash('ripemd160').update(Buffer.concat(check)).digest().slice(0, 4)
return base58.encode(Buffer.concat([keyBuffer, checksum]))
}
}
// Unlock
function clearBip32() {
document.getElementById('showBip32').style = 'display: none';
document.getElementById('showBip32Phrase').innerHTML = undefined;
document.getElementById('publicKeyCanvas1').innerHTML = undefined;
document.getElementById('publicKeyCanvas').innerHTML = undefined;
document.getElementById('privateKeyCanvas').innerHTML = undefined;
document.getElementById("publicKey1").textContent = undefined
document.getElementById("publicKey").textContent = undefined
document.getElementById("privateKey").textContent = undefined
}
// Unlock
function showBip32(mnemonic, passphrase = '') {
document.getElementById('showBip32').style = 'display: block';
document.getElementById('showBip32Phrase').onclick = onclickSelect('showBip32Phrase');
document.getElementById('showBip32Phrase').innerText = mnemonic;
// EOS 194 https://github.com/satoshilabs/slips/blob/master/slip-0044.md
// m/44'/194'/0'/0/0 https://github.com/tarassh/eos-ledger/blob/ec34ea2be018937085da7ac7fae9f3a360178ef9/getPublicKey.py#L46
const hdkey = HDKey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic, passphrase))
const eosPath = hdkey.derive("m/44'/194'/0'/0/0")
function toWif(privateKey) {
var privateKey = Buffer.from(privateKey)
// checksum includes the version
privateKey = Buffer.concat([new Buffer([0x80]), privateKey]);
return checkEncode(privateKey, 'sha256x2')
}
const privateWif = toWif(eosPath.privateKey, 0x80)
const pubkey = 'EOS' + checkEncode(Buffer.from(eosPath.publicKey))
document.getElementById('publicKey1').textContent = pubkey;
document.getElementById('publicKey').textContent = pubkey;
new QRious({
element: document.getElementById('publicKeyCanvas1'),
value: pubkey,
size: 150
});
new QRious({
element: document.getElementById('publicKeyCanvas'),
value: pubkey,
size: 150
});
document.getElementById('privateKey').textContent = privateWif;
document.getElementById('showBip32Passphrase').textContent = passphrase;
new QRious({
element: document.getElementById('privateKeyCanvas'),
value: privateWif,
size: 150
});
}
</script>
<div class="shadow">
<table class="row">
<tr>
<td>
<h5>Public Key</h5>
<canvas id="publicKeyCanvas1"></canvas>
</td>
</tr>
</table>
<div class="row">
<h5>Public Key <span style="color:green">(SHARE)</span></h5>
<span id="publicKey1" class="CopyText" onclick="onclickSelect('publicKey1')()"></span>
<br/>
</div>
<br/>
</div>
<br/>
<div class="shadow">
<table class="row">
<tr>
<td>
<h5>Public Key</h5>
<canvas id="publicKeyCanvas"></canvas>
</td>
<td>
<h5>Private Key </h5>
<canvas id="privateKeyCanvas"></canvas>
</td>
</tr>
</table>
<div class="row">
<h5>Public Key <span style="color:green">(SHARE)</span></h5>
<span id="publicKey" class="CopyText" onclick="onclickSelect('publicKey')()"></span>
<br/>
<h5>Private Key <span style="color:red">(DON'T SHARE)</span></h5>
<span id="privateKey" class="CopyText" onclick="onclickSelect('privateKey')()"></span>
<br/>
<h5>Mnemonic Phrase <span style="color:red">(DON'T SHARE)</span></h5>
<small>
<table>
<tr>
<td>Mnemonic</td>
<td><span class="CopyText" id="showBip32Phrase"></span></td>
</tr>
<tr>
<td>Passphrase</td>
<td><span class="CopyText" id="showBip32Passphrase" onclick="onclickSelect('showBip32Passphrase')()"></span></td>
</tr>
<tr>
<td>Path</td>
<td><span class="CopyText" id="showBip32Path" onclick="onclickSelect('showBip32Path')()">m/44'/194'/0'/0/0</span></td>
</tr>
</table>
</small>
<br/>
</div>
</div>
</div>
</main>
<footer>
<hr/>
<span id="footerDate" ></span>
<script>document.getElementById('footerDate').innerText = new Date().toDateString()</script>
–
<span id="footerHref" ></span>
<script>document.getElementById('footerHref').innerText = document.location.href</script>
<br/>
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GPL v3</a>
</footer>
</body>
</html>