diff --git a/index.html b/index.html
index 40805c1..efb588f 100644
--- a/index.html
+++ b/index.html
@@ -1,263 +1,328 @@
+
-
-
-
- Verified, This is a genuine certificate issued by RanchiMall.
-
+
-
-
-
- Verification failed!
-
-
-
-
-
- Try Again Later!
-
-
-
-
-
-
+
+
+ function verifyCertificate(id, certType, verifierContent) {
+ floBlockchainAPI.getTx(id).then(tx => {
+ let iVerify = false,
+ oVerify = false,
+ cVerify = false;
+ for (let i of tx.vin)
+ if (floGlobals.RMcertificateProvider === i.addr) {
+ iVerify = true;
+ break;
+ }
+ for (let o of tx.vout)
+ if (floGlobals.RMincorporationID === o.scriptPubKey.addresses[0]) {
+ oVerify = true;
+ break;
+ }
+ cVerify = tx.floData.startsWith(verifierContent);
+ if (iVerify && oVerify && cVerify) {
+ console.log(`${certType} (${id}) verified`);
+ let link = getBlockchainLink(`tx/${id}`),
+ content = tx.floData.substring(verifierContent.length).trim(),
+ time = `Issued: ${trimDate(tx.time * 1000)}`;
+ outputUI(certType, verifierContent, content, time);
+ showVerificationStatus('verified', link)
+ } else {
+ console.log(`${certType} (${id}) verification failed`);
+ showVerificationStatus('unverified')
+ }
+ }).catch(error => {
+ console.log(`${certType} (${id}) not verified`);
+ showVerificationStatus('error')
+ })
+ }
+
+ function outputUI(head, type, body, foot, link) {
+ let t = document.createElement('h3');
+ t.textContent = type;
+ let b = document.createElement('p');
+ b.innerHTML = body.replace(/([a-zA-Z0-9]){30,36}/, `
$&`);
+ let f = document.createElement('time');
+ f.textContent = foot;
+ document.getElementById("result_box").append(t, f, b);
+ }
+
+ function getBlockchainLink(path) {
+ let flosight = floBlockchainAPI.util.serverList[floBlockchainAPI.util.curPos]
+ return flosight + path
+ }
+
+ function trimDate(d) {
+ d = new Date(d).toString()
+ return `${d.substring(4, 10)}, ${d.substring(11, 15)}`
+ }
+
-
+
+