-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathendorser.html
394 lines (365 loc) · 14.7 KB
/
endorser.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
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<title>Get a Sovrin Network Endorser!</title>
<link rel="icon" href="/static/favicon.ico">
<style>
body {
width: 100%;
background-color: #FFFFFF; /* Dark Mode #00070F */
color: #000000; /* Dark Mode #F6F6F6 */
}
hr {
margin: 14px;
}
a:link, a:visited {
color: #f8a31a;
}
a:active, a:hover {
color: #0f6ecd;
}
a:link, a:visited, a:active, a:hover {
text-decoration: none;
}
p {
margin: 0px;
margin-bottom: 5px;
}
main div {
padding: 3px 3px 3px 3px;
}
form {
padding: 10px;
margin-top: 14px !important;
border-radius: 0px;
background-color: #f7f7f7;
}
form label{
font-size:x-large;
}
footer {
background-color: #001b42;
width: 100%;
min-height: 70px;
}
footer p{
color: #ffffff;
font-size: 15px;
margin-left: 20px;
padding-top: 25px;
margin-bottom: 0px;
}
#div_copy_top {
width: 100%;
align-content: Left;
font-size:x-large;
}
#div_results {
width: 100%;
background-color: black;
border-color: grey;
border-radius: .3rem;
color: white;
font-family: monospace;
font-weight: bold;
border-style: solid;
margin-top: 10px;
margin-bottom: 10px;
display: none;
}
#outputWeb {
width: 500px;
background-color: black;
border-color: grey;
color: white;
font-family: monospace;
border-style: solid;
float: left;
}
#outputListener {
width: 500px;
background-color: black;
border-color: grey;
color: white;
font-family: monospace;
border-style: solid;
float: left;
}
#banner {
background-color: #001b42;
width:100%;
min-height:70px;
padding: 5px;
}
.moveimage {
padding: 20px;
position: relative;
}
.loader {
border: 8px solid #f3f3f3; /* Light grey */
border-top: 8px solid #3498db; /* Blue */
border-radius: 50%;
width: 20px;
height: 20px;
animation: spin 2s linear infinite;
}
/* Bootstrap Adjustments */
.container-fluid {
padding: 0px;
}
.row {
margin: auto;
}
.text-muted {
color: #3F4549;
}
.card {
border: none;
border-radius: 0px;
background-color: #f7f7f7;
padding: 0px;
color: #555555;
}
.card-header {
border: none;
border-radius: 0px !important;
padding: 20px 0;
}
.card-title {
font-size: 1.5rem;
font-weight: bold;
}
#buildernet-card {
background-color: #7a7a7a;
}
#buildernet-card h6{
color: #c6c6c6 !important;
}
#stagingnet-card {
background-color: #54595f;
}
#stagingnet-card h6{
color: #aaaaaa !important;
}
#mainnet-card {
background-color: #f8a31b;
}
.btn-warning, .btn-warning:link, .btn-warning:visited, .btn-warning:active, .btn-warning:hover {
background-color: #f8a31b !important;
border-color: #f8a31b !important;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript" src="static/lib/axios/dist/axios.standalone.js"></script>
<script type="text/javascript" src="static/lib/CryptoJS/rollups/hmac-sha256.js"></script>
<script type="text/javascript" src="static/lib/CryptoJS/rollups/sha256.js"></script>
<script type="text/javascript" src="static/lib/CryptoJS/components/hmac.js"></script>
<script type="text/javascript" src="static/lib/CryptoJS/components/enc-base64.js"></script>
<script type="text/javascript" src="static/lib/url-template/url-template.js"></script>
<script type="text/javascript" src="static/lib/apiGatewayCore/sigV4Client.js"></script>
<script type="text/javascript" src="static/lib/apiGatewayCore/apiGatewayClient.js"></script>
<script type="text/javascript" src="static/lib/apiGatewayCore/simpleHttpClient.js"></script>
<script type="text/javascript" src="static/lib/apiGatewayCore/utils.js"></script>
<script type="text/javascript" src="static/apigClient.js"></script>
<script>
var captcha_response;
function verifyCaptcha(token) {
var submit_button = document.getElementById("submit_button");
captcha_response = token;
document.getElementById('g-recaptcha-error').innerHTML = '';
submit_button.classList.remove("disabled");
}
//var apigClient = apigClientFactory.newClient({region: 'us-west-2'});
function addEndorser () {
// displays div_results on submit. Display default is none.
document.getElementById('div_results').style.display = 'block'
var params = {};
var body = {
network: document.getElementById('network').value,
did: document.getElementById('did').value,
verkey: document.getElementById('verkey').value,
paymentaddr: document.getElementById('paymentaddr').value,
captcha_response: captcha_response
};
var additionalParams = {};
document.getElementById('div_results').innerHTML = "<div class='loader'></div>"
// apigClient.nymPost(params, body, additionalParams)
$.post("/nym",
JSON.stringify(body),
function(data, textStatus) {
//This is where you would put a success callback
console.log(textStatus);
console.log(data);
data = JSON.parse(data);
did=document.getElementById('did').value;
console.log("Succeeded adding " + did + " as an Endorser!");
if(did in data) {
console.log("Found DID " + did + " in data");
message = data[did].status + ": " +
data[did].reason;
console.log("message="+message);
} else {
console.log("Did not find DID " + did + " in data");
message = JSON.stringify(data)
}
document.getElementById('div_results').innerHTML = message;
}).fail( function(jqXHR, textStatus, error){
//This is where you would put an error callback
console.log("Failed!");
console.log(textStatus);
console.log(error);
message = "";
data = JSON.parse(jqXHR.responseText);
switch(jqXHR.statusCode) {
case 400:
did=document.getElementById('did').value;
console.log("Validation errors on DID: " + did);
if(did in jqXHR.responseText) {
console.log("Found DID " + did + " in response");
message += "Validation Errors: <ol>";
errors = data[did];
errors.forEach(function (entry) {
message += "<li>" + entry + "</li>";
});
message += "</ol>";
console.log("message="+message);
} else {
console.log("Did not find DID " + did + " in data");
message = JSON.stringify(data)
}
break;
case 409:
case 500:
did=document.getElementById('did').value;
console.log("DID: " + did);
if(did in jqXHR.responseText) {
console.log("Found DID " + did + " in data");
message = data[did].status + ": " +
data[did].reason;
console.log("message="+message);
} else {
console.log("Did not find DID " + did + " in data");
message = JSON.stringify(data)
}
break;
case 404:
default:
message = data.message;
}
document.getElementById('div_results').innerHTML = message;
});
}
</script>
</head>
<body>
<header class="site-header">
<div class="container-fluid">
<div id="banner">
<a href="https://sovrin.org"><img class="moveimage" src="https://sovrin.org/wp-content/themes/sovrin/assets/images/logo.svg"></a>
</div>
</div>
</header>
<main role="main" class="container-fluid">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<h1 align="center"> Setup a Sovrin Network Transaction Endorser!</h1>
<hr />
<div class="row row-cols-1 row-cols-md-3">
<div class="col">
<div class="card h-100 text-center">
<div class="card-header text-light" id="buildernet-card">
<h5 class="card-title">BuilderNet</h5>
<h6 class="card-subtitle mb-2 text-muted">Development</h6>
</div>
<div class="card-body">
<p class="card-text">Developers can get a Transaction Endorser DID on the Sovrin BuilderNet by submitting the form below. BuilderNet Endorser DIDs are free for development use and retain their “Endorser” privileges for 6 months. Transactions on BuilderNet are also free.</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100 text-center">
<div class="card-header text-light" id="stagingnet-card">
<h5 class="card-title">StagingNet</h5>
<h6 class="card-subtitle mb-2 text-muted">Staging</h6>
</div>
<div class="card-body">
<p class="card-text">Looking to go beyond development? The Sovrin StagingNet is for prototyping and demonstrating pre-production SSI applications & services. To learn more and to get a Sovrin StagingNet Endorser DID, click <a href="https://sovrin.org/stagingnet-endorser-did-order-form/" target="_blank">here</a>.</p>
</div>
</div>
</div>
<div class="col">
<div class="card h-100 text-center">
<div class="card-header text-light" id="mainnet-card">
<h5 class="card-title">MainNet</h5>
<h6 class="card-subtitle mb-2 text-muted">Production</h6>
</div>
<div class="card-body">
<p class="card-text">Ready for production? Sovrin MainNet is for scaling live SSI applications & services. To learn more and to apply for a Sovrin MainNet Endorser DID, click <a href="https://sovrin.org/mainnet-endorser-did-application-form/" target="_blank">here</a>.</p>
</div>
</div>
</div>
</div>
<form class="row align-items-center">
<div id="div_copy_top">
<p style="margin-bottom: 0px;">Enter a DID and verkey for your BuilderNet Endorser DID:</p>
</div>
<div class="col-sm-4">
<label id="Select">Network</label>
<div class="col-sm-10">
<select class="form-control" name="network" id="network" disabled readonly>
<option value="buildernet" selected>BuilderNet - Development</option>
</select>
</div>
</div>
<div class="col-sm-4">
<label>DID</label>
<div class="col-sm-10">
<input class="form-control" name="did" id="did" placeholder="DID" type="text" maxlength="24"/>
</div>
</div>
<div class="col-sm-4">
<label>Verkey</label>
<div class="col-sm-10">
<input class="form-control" name="verkey" id="verkey" placeholder="Verkey" type="text" maxlength="44"/>
</div>
</div>
<div class="col-sm-3" style="display: none;">
<label>Payment-Address</label>
<div class="col-sm-10">
<input class="form-control" name="paymentaddr" id="paymentaddr" placeholder="Payment-Address" type="text" size="50"/>
</div>
</div>
<div>
<p>By clicking "Submit" you signify agreement to the Sovrin <a href="https://github.com/sovrin-foundation/sovrin/blob/master/TAA/TAA.md" target="_blank">Transaction Author Agreement</a></p>
<!-- This is a message box. It is required for this page to work. -->
<div id="div_results"></div>
<div style="display: flex;align-items: center; margin-bottom: 10px;">
<input class="btn btn-warning btn-lg text-light disabled" id="submit_button" type="button" value="Submit" onclick="addEndorser();" />
<div class="g-recaptcha" data-sitekey="6LdD03AfAAAAAO4KiIt1oz1l8gQaG8-aRd1g8It0" data-callback="verifyCaptcha"></div>
<div id="g-recaptcha-error"></div>
</div>
</div>
</form>
<script src='https://www.google.com/recaptcha/api.js'></script>
<div>
<a href=https://docs.google.com/document/d/1sXZoN18lpFoAF075QoptofwDV_1otUylPGFKRQnA56E target="_blank"> Help me get a DID!</a>
</div>
</div>
<div class="col-md-2"></div>
</div>
</main>
<footer class="footer mt-auto">
<p>Copyright © <script>document.write(new Date().getFullYear());</script> <a href="https://sovrin.org/" target="_blank">Sovrin Foundation</a>. All Rights Reserved.</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
</body>
</html>