forked from aenima86/paper-wallet-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
52 lines (33 loc) · 1.16 KB
/
script.js
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
// Load nem-browser library
var nem = require("nem-sdk").default;
// Create random bytes from PRNG
var rBytes = nem.crypto.nacl.randomBytes(32);
// Convert the random bytes to hex
var privateKey = nem.utils.convert.ua2hex(rBytes);
var keyPair = nem.crypto.keyPair.create(privateKey);
var publicKey = keyPair.publicKey.toString();
var address = nem.model.address.toAddress(publicKey, nem.model.network.data.mainnet.id);
var qrcodePrivatekey = new QRCode(document.getElementById("qrprivatekey"), {
width : 200,
height : 200
});
var qrcodePublickey = new QRCode(document.getElementById("qrpublickey"), {
width : 200,
height : 200
});
var qrcodePublicAdd = new QRCode(document.getElementById("qrpublicaddress"), {
width : 200,
height : 200
});
var qrcodeDonations = new QRCode(document.getElementById("qrdonations"), {
width : 200,
height : 200,
colorDark : "#007acc"
});
$('#privatekey').html(privateKey);
qrcodePrivatekey.makeCode(privateKey);
$('#publickey').html(publicKey);
qrcodePublickey.makeCode(publicKey);
$('#publicaddress').html(address);
qrcodePublicAdd.makeCode(address);
qrcodeDonations.makeCode("NBSTZ5FIQHZ2LOICL3X2NAEP53OIQS6LZOUXIAR4");