forked from ehn-dcc-development/hcert-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
71 lines (67 loc) · 3.48 KB
/
demo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HCERT Validation Demo</title>
<style>
textarea, button, input {
display: block;
}
</style>
<script src="build/distributions/hcert-kotlin.js"></script>
<script>
document.onload = function () {
let tQR = document.getElementById("tQR");
let tCert = document.getElementById("tCert");
let tRes = document.getElementById("tRes");
let tValid = document.getElementById("tValid");
let tError = document.getElementById("tError");
let tMeta = document.getElementById("tMeta");
let tEgc = document.getElementById("tEgc");
tRes.value = ""
tValid.value = ""
tError.value = ""
tMeta.value = ""
tEgc.value = ""
}
function validate() {
let qr = tQR.value.trim()
let pemCert = tCert.value.trim()
let verifier = new hcert.Verifier([pemCert]);
let result = verifier.verify(qr);
console.info(result);
tRes.value = JSON.stringify(result, null, 2);
tValid.value = JSON.stringify(result.isValid, null, 2);
tError.value = JSON.stringify(result.error, null, 2);
tMeta.value = JSON.stringify(result.metaInformation, null, 2);
tEgc.value = JSON.stringify(result.greenCertificate, null, 2);
}
</script>
</head>
<body>
<p>
<label for="tCert">PEM-Encoded Certificate</label><textarea rows="10" cols="100" id="tCert">MIIBvTCCAWOgAwIBAgIKAXk8i88OleLsuTAKBggqhkjOPQQDAjA2MRYwFAYDVQQDDA1BVCBER0MgQ1NDQSAxMQswCQYDVQQGEwJBVDEPMA0GA1UECgwGQk1TR1BLMB4XDTIxMDUwNTEyNDEwNloXDTIzMDUwNTEyNDEwNlowPTERMA8GA1UEAwwIQVQgRFNDIDExCzAJBgNVBAYTAkFUMQ8wDQYDVQQKDAZCTVNHUEsxCjAIBgNVBAUTATEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASt1Vz1rRuW1HqObUE9MDe7RzIk1gq4XW5GTyHuHTj5cFEn2Rge37+hINfCZZcozpwQKdyaporPUP1TE7UWl0F3o1IwUDAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFO49y1ISb6cvXshLcp8UUp9VoGLQMB8GA1UdIwQYMBaAFP7JKEOflGEvef2iMdtopsetwGGeMAoGCCqGSM49BAMCA0gAMEUCIQDG2opotWG8tJXN84ZZqT6wUBz9KF8D+z9NukYvnUEQ3QIgdBLFSTSiDt0UJaDF6St2bkUQuVHW6fQbONd731/M4nc=</textarea>
</p>
<p>
<label for="tQR">QR Code Contents</label><textarea rows="10" cols="100" id="tQR">HC1:NCFTW2H:7*I06R3W/J:O6:P4QB3+7RKFVJWV66UBCE//UXDT:*ML-4D.NBXR+SRHMNIY6EB8I595+6UY9-+0DPIO6C5%0SBHN-OWKCJ6BLC2M.M/NPKZ4F3WNHEIE6IO26LB8:F4:JVUGVY8*EKCLQ..QCSTS+F$:0PON:.MND4Z0I9:GU.LBJQ7/2IJPR:PAJFO80NN0TRO1IB:44:N2336-:KC6M*2N*41C42CA5KCD555O/A46F6ST1JJ9D0:.MMLH2/G9A7ZX4DCL*010LGDFI$MUD82QXSVH6R.CLIL:T4Q3129HXB8WZI8RASDE1LL9:9NQDC/O3X3G+A:2U5VP:IE+EMG40R53CG9J3JE1KB KJA5*$4GW54%LJBIWKE*HBX+4MNEIAD$3NR E228Z9SS4E R3HUMH3J%-B6DRO3T7GJBU6O URY858P0TR8MDJ$6VL8+7B5$G CIKIPS2CPVDK%K6+N0GUG+TG+RB5JGOU55HXDR.TL-N75Y0NHQTZ3XNQMTF/ZHYBQ$8IR9MIQHOSV%9K5-7%ZQ/.15I0*-J8AVD0N0/0USH.3</textarea>
</p>
<p>
<button onClick="validate()">Validate</button>
</p>
<p>
<label for="tRes">Overall Structure</label><textarea rows="60" cols="100" id="tRes" disabled></textarea>
</p>
<p>
<label for="tValid">IsValid</label><textarea rows="5" cols="100" id="tValid" disabled></textarea>
</p>
<p>
<label for="tError">Error</label><textarea rows="5" cols="100" id="tError" disabled></textarea>
</p>
<p>
<label for="tMeta">Meta Information</label><textarea rows="30" cols="100" id="tMeta" disabled></textarea>
</p>
<p>
<label for="tEgc">Green Certificate</label><textarea rows="30" cols="100" id="tEgc" disabled></textarea>
</p>
</body>
</html>