forked from nebulasio/web-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
112 lines (97 loc) · 3.86 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<link rel="icon shortcut" href=img/logo.png type=image/png>
<link rel=apple-touch-icon href=img/logo.png>
<link rel=stylesheet href=lib/bootstrap-4.0.0-dist/css/bootstrap.min.css>
<link rel=stylesheet href=css/base.css>
<link rel=stylesheet href=css/ui-block.css>
<meta name=viewport content="width=device-width">
<title>NEBULAS</title>
<style>
input {
text-align: center;
}
.active1 {
display: none;
}
.download {
margin-top: 48px;
text-align: center;
}
.wallet_help {
font-size: 0.8rem;
}
</style>
</head>
<body>
<div class=logo-main></div>
<div class=header></div>
<div class="container wallet">
<div id=newWallet>
<div class=form-group>
<label for=password data-i18n=new/enter-password>Enter a password:(Not less than 9 characters)</label>
<input type=password class=form-control id=password data-i18n=new/placeholder/do-not-forget placeholder="Do NOT forget to save this!" data-validate-order-matters="required lengthGt8">
</div>
<button class="btn btn-block" data-i18n=new/new id=creat>Create New Wallet</button>
</div>
<div class="active1 download">
<h1>
<span data-i18n=new/save1>Save your</span>
<code data-i18n=keystore-file></code>
<span data-i18n=new/save3>File.</span>
</h1>
<button class="btn btn-block" data-i18n=new/gen>Download Keystore File</button>
</div>
<p class=wallet_help data-i18n=new/comment>
This password encrypts your private key.
<br>This does not act as a seed to generate your keys.
<br>You will need this password + your private key to unlock your wallet.
</p>
</div>
<div class=footer></div>
<script src=lib/jquery-3.3.1.min.js></script>
<script src=lib/bootstrap-4.0.0-dist/js/bootstrap.bundle.min.js data-depends=jquery.slim></script>
<script src=lib/bootbox.min.js data-depends="bootstrap jquery.slim"></script>
<script src=lib/Blob.js></script>
<script src=lib/FileSaver.min.js></script>
<script src=lib/nebulas.js></script>
<script src=js/1-localSave.js></script>
<script src=js/home.v1.js></script>
<script src=js/i18n.js data-depends=jquery.slim></script>
<script src=js/ui-block.js data-depends="bootbox blockies jquery.slim i18n.js nebulas.js"></script>
<script>
"use strict";
// replace ="([^ =]+)" with =$1
var nebulas = require("nebulas"),
account = nebulas.Account.NewAccount(), //TODO:流程位置 应该在创建之后 。创建密码应该删除
validateAll = uiBlock.validate();
uiBlock.insert({
footer: ".footer",
header: ".header",
logoMain: ".logo-main"
});
$("#creat").on("click", onClickCreate);
$(".download button").on("click", onClickDownloadButton);
function onClickCreate() {
validateAll() && $(".download").removeClass("active1");
}
function onClickDownloadButton() {
var password = $("#password").val(), address, keyStr, blob;
if (validateAll()) {
bootbox.alert({
message: "waiting...",
title: "info"
});
// window.open('tokey.html?password=' + password, '_blank');
address = account.getAddressString();
keyStr = account.toKeyString(password);
blob = new Blob([keyStr], { type: "application/json; charset=utf-8" });
saveAs(blob, address);
bootbox.hideAll();
}
}
</script>
</body>
</html>