|
|
<!doctype html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<link rel="stylesheet" href="css/style.v2.css">
|
|
|
<link rel="stylesheet" href="css/topnav.css">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
<link rel="shortcut icon" href="https://www.pathcheck.org/hubfs/Favicon.png">
|
|
|
<title>DIVOC Credentials Generator and Verifier</title>
|
|
|
|
|
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-DTDMHW3NV6"></script>
|
|
|
<script>
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
gtag('js', new Date());
|
|
|
gtag('config', 'G-DTDMHW3NV6');
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="topnav">
|
|
|
<div class="topnavContainer">
|
|
|
<a class="active" href="index.html">Signers</a>
|
|
|
<a href="verify.html"><span class="xs-hidden">Universal </span>Verifier</a>
|
|
|
<a class="xs-hidden" href="debug.html">QR Debugger</a>
|
|
|
<a class="xs-hidden" href="https://github.com/Path-Check/paper-cred-demo">Source Code</a>
|
|
|
<a href="https://github.com/Path-Check/paper-cred"><span class="xs-hidden"> QR </span>Specs</a>
|
|
|
<a href="http://vaccine-docs.pathcheck.org"><span class="xs-hidden">Vaccine </span>Docs</a>
|
|
|
<a class="xs-hidden" href="http://pathcheck.org">About PathCheck</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="subnav">
|
|
|
<div class="subnavContainer">
|
|
|
<a href="index.v5.html">PCF<span class="xs-hidden">'s 4 QRs</span></a>
|
|
|
<a href="eu.dgc.html">EU<span class="xs-hidden"> Covid Pass</span></a>
|
|
|
<a href="icao.html">ICAO<span class="xs-hidden"> Seals</span></a>
|
|
|
<a class="active" href="cowin.html">DIVOC<span class="xs-hidden">/India</span></a>
|
|
|
<a class="xs-hidden" href="opencerta.html"><span class="xs-hidden">Open</span>Certa</a>
|
|
|
<a href="vial.html">Vial<span class="xs-hidden"> Label</span></a>
|
|
|
<a href="us.ma.id.html"><span class="xs-hidden">Mass </span>ID</a>
|
|
|
<a href="banknote.html">Cash<span class="xs-hidden"> Bills</span></a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="center">
|
|
|
<h1>DIVOC's India Cowin</h1>
|
|
|
<div class="full-div">
|
|
|
<div class="two-quarter">
|
|
|
<h4>W3C VC Overhead</h4>
|
|
|
<table>
|
|
|
<tr><td>Context</td><td><input id="qr-head-context" type="text" placeholder="https://www.w3.org/2018/credentials/v1, https://cowin.gov.in/credentials/vaccination/v1"/></td></tr>
|
|
|
<tr><td>IssueDate</td><td><input id="qr-head-issuance-date" type="text" placeholder="YYMMDD"/></td></tr>
|
|
|
<tr><td>Issuer</td><td><input id="qr-head-issuer" type="text" placeholder="https://cowin.gov.in/"/></td></tr>
|
|
|
<tr><td>Type</td><td><input id="qr-head-type" type="text" placeholder="VerifiableCredential, ProofOfVaccinationCredential"/></td></tr>
|
|
|
<tr><td>NonTrans</td><td><input id="qr-head-nontransfer" type="text" placeholder="true"/></td></tr>
|
|
|
</table>
|
|
|
<h4>Patient</h4>
|
|
|
<table>
|
|
|
<tr><td>Type</td><td><input id="qr-pat-type" type="text" placeholder="Person"/></td></tr>
|
|
|
<tr><td>ID</td><td><input id="qr-pat-id" type="text" placeholder="did:in.gov.uidai..."/></td></tr>
|
|
|
<tr><td>Ref ID</td><td><input id="qr-pat-refid" type="text" placeholder="123123123"/></td></tr>
|
|
|
<tr><td>Name</td><td><input id="qr-pat-name" type="text" placeholder="Name ..."/></td></tr>
|
|
|
<tr><td>Gender</td><td><input id="qr-pat-gender" type="text" placeholder="Male, ..."/></td></tr>
|
|
|
<tr><td>Age</td><td><input id="qr-pat-age" type="text" placeholder="23..."/></td></tr>
|
|
|
<tr><td>Nationality</td><td><input id="qr-pat-nationality" type="text" placeholder="Indian.. "/></td></tr>
|
|
|
</table>
|
|
|
|
|
|
<h4>Location</h4>
|
|
|
<table>
|
|
|
<tr><td>Address 1</td><td><input id="qr-location-address1" type="text" placeholder="3rd St"/></td></tr>
|
|
|
<tr><td>Address 2</td><td><input id="qr-location-address2" type="text" placeholder="Apt xx"/></td></tr>
|
|
|
<tr><td>District</td><td><input id="qr-location-district" type="text" placeholder="Somerville"/></td></tr>
|
|
|
<tr><td>City</td><td><input id="qr-location-city" type="text" placeholder="Somerville"/></td></tr>
|
|
|
<tr><td>State</td><td><input id="qr-location-state" type="text" placeholder="MA"/></td></tr>
|
|
|
<tr><td>Zip</td><td><input id="qr-location-zip" type="text" placeholder="02141"/></td></tr>
|
|
|
<tr><td>Country</td><td><input id="qr-location-country" type="text" placeholder="USA"/></td></tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="two-quarter">
|
|
|
<h4>Evidence</h4>
|
|
|
<table>
|
|
|
<tr><td>ID</td><td><input id="qr-immunization-id" type="text" placeholder="undefined"/></td></tr>
|
|
|
<tr><td>Type</td><td><input id="qr-immunization-type" type="text" placeholder="Vaccination"/></td></tr>
|
|
|
|
|
|
<tr><td>Manuf</td><td><input id="qr-immunization-manuf" type="text" placeholder="AstraZeneca, ..."/></td></tr>
|
|
|
<tr><td>Product</td><td><input id="qr-immunization-product" type="text" placeholder="COVID19"/></td></tr>
|
|
|
<tr><td>Batch#</td><td><input id="qr-immunization-lot" type="text" placeholder="012L20A, ..."/></td></tr>
|
|
|
<tr><td>Date</td><td><input id="qr-immunization-date" type="text" placeholder=""/></td></tr>
|
|
|
<tr><td>EffectStart</td><td><input id="qr-immunization-eff-start" type="text" placeholder="YYYYMMDD"/></td></tr>
|
|
|
<tr><td>EffectEnd</td><td><input id="qr-immunization-eff-end" type="text" placeholder="YYYYMMDD"/></td></tr>
|
|
|
<tr><td>Dose</td><td><input id="qr-immunization-dose" type="text" placeholder="1, ..."/></td></tr>
|
|
|
<tr><td>Doses</td><td><input id="qr-immunization-total-doses" type="text" placeholder="2, ..."/></td></tr>
|
|
|
|
|
|
<tr><td>Verifier</td><td><input id="qr-immunization-verifier" type="text" placeholder="Name"/></td></tr>
|
|
|
</table>
|
|
|
<h4>Facility</h4>
|
|
|
<table>
|
|
|
<tr><td>Name</td><td><input id="qr-facility-name" type="text" placeholder="3rd St"/></td></tr>
|
|
|
<tr><td>Address 1</td><td><input id="qr-facility-address1" type="text" placeholder="3rd St"/></td></tr>
|
|
|
<tr><td>Address 2</td><td><input id="qr-facility-address2" type="text" placeholder="Apt xx"/></td></tr>
|
|
|
<tr><td>District</td><td><input id="qr-facility-district" type="text" placeholder="Somerville"/></td></tr>
|
|
|
<tr><td>City</td><td><input id="qr-facility-city" type="text" placeholder="Somerville"/></td></tr>
|
|
|
<tr><td>State</td><td><input id="qr-facility-state" type="text" placeholder="MA"/></td></tr>
|
|
|
<tr><td>Zip</td><td><input id="qr-facility-zip" type="text" placeholder="02141"/></td></tr>
|
|
|
<tr><td>Country</td><td><input id="qr-facility-country" type="text" placeholder="USA"/></td></tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="quarter">
|
|
|
<h4>Credentials</h4>
|
|
|
<label for="privkey">Private Key</label><br/>
|
|
|
<textarea id="privkey" rows="10" cols="30">-----BEGIN EC PARAMETERS-----
|
|
|
BgUrgQQACg==
|
|
|
-----END EC PARAMETERS-----
|
|
|
-----BEGIN EC PRIVATE KEY-----
|
|
|
MHQCAQEEIPWKbSezZMY1gCpvN42yaVv76Lo47FvSsVZpQl0a5lWRoAcGBSuBBAAK
|
|
|
oUQDQgAE6DeIun4EgMBLUmbtjQw7DilMJ82YIvOR2jz/IK0R/F7/zXY1z+gqvFXf
|
|
|
DcJqR5clbAYlO9lHmvb4lsPLZHjugQ==
|
|
|
-----END EC PRIVATE KEY-----</textarea>
|
|
|
<br><br>
|
|
|
<label for="pubkey">Public Key</label><br/>
|
|
|
<textarea id="qr-link" rows="1" cols="30">1A9.PCF.PW</textarea>
|
|
|
<br>
|
|
|
|
|
|
<label for="privkeyDivoc">DIVOC Private Key</label><br/>
|
|
|
<textarea id="privkeyDivoc" rows="10" cols="30">-----BEGIN RSA PRIVATE KEY-----
|
|
|
MIIEowIBAAKCAQEAnXQalrgztecTpc+INjRQ8s73FSE1kU5QSlwBdICCVJBUKiuQUt7s+Z5epgCvLVAOCbP1mm5lV7bfgV/iYWDio7lzX4MlJwDedWLiufr3Ajq+79CQiqPaIbZTo0i13zijKtX7wgxQ78wT/HkJRLkFpmGeK3za21tEfttytkhmJYlwaDTEc+Kx3RJqVhVh/dfwJGeuV4Xc/e2NH++ht0ENGuTk44KpQ+pwQVqtW7lmbDZQJoOJ7HYmmoKGJ0qt2hrj15uwcD1WEYfY5N7N0ArTzPgctExtZFDmituLGzuAZfv2AZZ9/7Y+igshzfB0reIFdUKw3cdVTzfv5FNrIqN5pwIDAQABAoIBAHPILMUoLt5UTd5f/YnebqgeCRNAmGOBcwk7HtbMqQoGF93qqvZFd30XOAJZ/ncTpz77Vl95ToxxrWk1WQLCe+ZpOK3Dgk5sFSm8zXx1T64UBNPUSnWoh37C1D39+b9rppCZScgnxlyPdSLy3h3q8Hyoy+auqUEkm/ms5W2lT3fJscyN1IAyHrhsOBWjl3Ilq5GxBo5tbYv/Fb1pQiP/p2SIHA1+2ASXNYQP100F5Vn0V6SFtBXTCQnwcvbP083NvlGxs9+xRs3MCUcxCkKepWuzYwOZDmu/2yCz1/EsP6wlsYEHmCZLdIb0tQt0caqzB/RoxfBpNRIlhOtqHvBzUgECgYEAzIRn5Y7lqO3N+V29wXXtVZjYWvBh7xUfOxAwVYv0rKI0y9kHJHhIrU+wOVOKGISxBKmzqBQRPvXtXW8E0/14Zz82g60rRwtNjvW0UoZAY3KPouwruUIjAe2UnKZcQ//MBTrvds8QGpL6nxvPsBqU0y2K+ySAOxBtNtGEjzv8nxUCgYEAxRbMWukIbgVOuQjangkfJEfA1UaRFQqQ8jUmT9aiq2nREnd4mYP8kNKzJa9L7zj6Un6yLH5DbGspZ2gGODeRw3uVFN8XSzRdLvllNEyiG/waiysUtXfG2DPOR6xD8tXXDMm/tl9gTa8cbkvqYy10XT9MpfOAsusEZVmc0/DBBMsCgYAYdAxoKjnThPuHwWma5BrIjUnxNaTADWp6iWj+EYnjylE9vmlYNvmZn1mWwSJV5Ce2QwQ0KJIXURhcf5W4MypeTfSase3mxLc1TLOO2naAbYY3GL3xnLLK3DlUsZ9+kes3BOD097UZOFG3DIA8sjDxPxTLCoY6ibBFSa/r4GRIMQKBgQCranDCgPu79RHLDVBXM0fKnj2xQXbd/hqjDmcL+Xnx7E7S6OYTXyBENX1qwVQh9ESDi34cBJVPrsSME4WVT3+PreS0CnSQDDMfr/m9ywkTnejYMdgJHOvtDuHSpJlUk3g+vxnm3H0+E5d+trhdGiOjFnLrwyWkd5OTMqWcEEFQkQKBgFfXObDz/7KqeSaAxI8RzXWbI3Fa492b4qQUhbKYVpGn98CCVEFJr11vuB/8AXYCa92OtbwgMw6Ah5JOGzRScJKdipoxo7oc2LJ9sSjjw3RB/aWl35ChvnCJhmfSL8Usbj0nWVTrPwRLjMC2bIxkLtnm9qYXPumW1EjEbusjVMpN
|
|
|
-----END RSA PRIVATE KEY-----</textarea>
|
|
|
<br>
|
|
|
<label for="pubKeyIdDivoc">Public kID</label><br/>
|
|
|
<textarea id="pubKeyIdDivoc" rows="1" cols="30">did:india</textarea>
|
|
|
<br>
|
|
|
<label for="pubkeyDivoc">Public Key</label><br/>
|
|
|
<textarea id="pubKeyDivoc" rows="6" cols="30">-----BEGIN PUBLIC KEY-----
|
|
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnXQalrgztecTpc+INjRQ8s73FSE1kU5QSlwBdICCVJBUKiuQUt7s+Z5epgCvLVAOCbP1mm5lV7bfgV/iYWDio7lzX4MlJwDedWLiufr3Ajq+79CQiqPaIbZTo0i13zijKtX7wgxQ78wT/HkJRLkFpmGeK3za21tEfttytkhmJYlwaDTEc+Kx3RJqVhVh/dfwJGeuV4Xc/e2NH++ht0ENGuTk44KpQ+pwQVqtW7lmbDZQJoOJ7HYmmoKGJ0qt2hrj15uwcD1WEYfY5N7N0ArTzPgctExtZFDmituLGzuAZfv2AZZ9/7Y+igshzfB0reIFdUKw3cdVTzfv5FNrIqN5pwIDAQAB
|
|
|
-----END PUBLIC KEY-----</textarea>
|
|
|
<br>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="full-div"></div>
|
|
|
<div class="four-quarter">
|
|
|
<br>
|
|
|
<button class="qr-btn" onclick="generateQRCodes()">Generate Credentials</button>
|
|
|
<br><br>
|
|
|
</div>
|
|
|
<div class="full-div">
|
|
|
<div class="two-quarter">
|
|
|
<h4>PCF's Format (<a href='https://github.com/Path-Check/paper-cred/blob/main/payloads/cowin.1.md'>Spec</a>)</h4>
|
|
|
<canvas id="qr-divoc-code"></canvas><br/>
|
|
|
<h4 id="qr-divoc-pdf-label" style="display: none;">PDF 417 Format</h4>
|
|
|
<canvas id="qr-divoc-pdf" style="display: none;"></canvas>
|
|
|
<pre id="qr-divoc-result"></pre>
|
|
|
<pre id="qr-divoc-bytes" class="xs-hidden"></pre>
|
|
|
</div>
|
|
|
<div class="two-quarter">
|
|
|
<h4>Original DIVOC Format</h4>
|
|
|
<canvas id="qr-divoc-orig-code"></canvas>
|
|
|
<h4 id="qr-divoc-orig-pdf-label" style="display: none;">PDF 417 Format</h4>
|
|
|
<canvas id="qr-divoc-orig-pdf" style="display: none;"></canvas>
|
|
|
<pre id="qr-divoc-orig-result" style="display: none;" onclick="copyToClipboard();"></pre>
|
|
|
<pre id="qr-divoc-orig-bytes" class="xs-hidden"></pre>
|
|
|
</div>
|
|
|
|
|
|
<div class="quarter xs-hidden">
|
|
|
<label for="verify">Verify a QR Code</small></label><br/>
|
|
|
<textarea id="qr-verify" rows="10" cols="30" placeholder="cred:type:version:signature:pubkey:payload"></textarea>
|
|
|
<br><br>
|
|
|
<button class="qr-btn" onclick="verifyQRCode()">Verify</button>
|
|
|
<br><br>
|
|
|
<pre id="qr-verify-result"></pre>
|
|
|
<pre id="qr-verify-verified"></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div style="position:fixed;top:calc(50% - 250px);right:0;transition:width 300ms ease-out;width:0;" data-qa="side_panel"> <a class="typeform-share button" href="https://form.typeform.com/to/cGJGC6zl?typeform-medium=embed-snippet" data-mode="side_panel" style="box-sizing:border-box;position:absolute;top:300px;width:200px;height:48px;padding:0 20px;margin:0;cursor:pointer;background:#0F69BE;border-radius:4px 4px 0px 0px;box-shadow:0px 2px 12px rgba(0, 0, 0, 0.06), 0px 2px 4px rgba(0, 0, 0, 0.08);display:flex;align-items:center;justify-content:flex-start;transform:rotate(-90deg);transform-origin:bottom left;color:white;text-decoration:none;z-index:9999;" data-width="320" data-height="500" target="_blank"> <span class="icon" style="width:32px;position:relative;text-align:center;transform:rotate(90deg) scale(0.85);left:-8px;"> <svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' style="margin-top:10px;"> <path d='M21 0H0V9L10.5743 24V16.5H21C22.6567 16.5 24 15.1567 24 13.5V3C24 1.34325 22.6567 0 21 0ZM7.5 9.75C6.672 9.75 6 9.07875 6 8.25C6 7.42125 6.672 6.75 7.5 6.75C8.328 6.75 9 7.42125 9 8.25C9 9.07875 8.328 9.75 7.5 9.75ZM12.75 9.75C11.922 9.75 11.25 9.07875 11.25 8.25C11.25 7.42125 11.922 6.75 12.75 6.75C13.578 6.75 14.25 7.42125 14.25 8.25C14.25 9.07875 13.578 9.75 12.75 9.75ZM18 9.75C17.172 9.75 16.5 9.07875 16.5 8.25C16.5 7.42125 17.172 6.75 18 6.75C18.828 6.75 19.5 7.42125 19.5 8.25C19.5 9.07875 18.828 9.75 18 9.75Z' fill='white' /> </svg> </span> <span style="text-decoration:none;font-size:18px;font-family:Helvetica,Arial,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;"> Suggestions? </span> </a> </div> <script> (function() { var qs,js,q,s,d=document, gi=d.getElementById, ce=d.createElement, gt=d.getElementsByTagName, id="typef_orm_share", b="https://embed.typeform.com/"; if(!gi.call(d,id)){ js=ce.call(d,"script"); js.id=id; js.src=b+"embed.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(js,q) } })() </script>
|
|
|
|
|
|
<div class="footer">
|
|
|
<div class="footerContainer">
|
|
|
<img src="https://www.pathcheck.org/hubfs/pathcheck-foundation-logo-white.svg" alt="pathcheck-foundation-logo-white" width="264" style="width: 264px; max-width: 264px; margin: 0px 0px 5px;">
|
|
|
<span style="font-size: 14px;">
|
|
|
<br>©2021. PathCheck Foundation – a 501(c)(3) nonprofit.
|
|
|
<br>Content is distributed under the Creative Commons CC-BY License unless otherwise stated. PathCheck is a trademark of PathCheck Foundation.
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script src="js/qrcode.min.js"></script>
|
|
|
|
|
|
<script src="js/libbcmath.js" type="text/javascript"></script>
|
|
|
<script src="js/bcmath.js" type="text/javascript"></script>
|
|
|
<script src="js/pdf417.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="js/pcf-utils.js"></script>
|
|
|
<script src="js/ui-utils.js"></script>
|
|
|
|
|
|
<script src="js/divoc-sdk.min.js"></script>
|
|
|
<script src="js/cred-sdk.min.js"></script>
|
|
|
|
|
|
<script>
|
|
|
function e(elem) { return document.getElementById(elem); }
|
|
|
|
|
|
function getValueArray(elemArray) {
|
|
|
const fields = elemArray.map(function(elemId) {
|
|
|
if (!e(elemId)) console.log('Could not find ' + elemId);
|
|
|
return e(elemId).value;
|
|
|
})
|
|
|
return fields;
|
|
|
}
|
|
|
|
|
|
function signAndDisplayQR(elemPref, _type, _version, priKeyPEM, pubKeyId, payloadValueArray) {
|
|
|
CRED.signAndPack(_type, _version, priKeyPEM, pubKeyId, payloadValueArray).then(uri => {
|
|
|
PCFUtils.debugURI(uri).then( debugInfo => {
|
|
|
UIUtils.drawsQR(elemPref, uri, debugInfo);
|
|
|
|
|
|
CRED.unpackAndVerify(uri).then(result => {
|
|
|
UIUtils.drawVerifiedSymbol(elemPref+'-code',result);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function parse(str) {
|
|
|
if(!/^(\d){8}$/.test(str)) return "invalid date";
|
|
|
var y = str.substr(0,4),
|
|
|
m = str.substr(4,2),
|
|
|
d = str.substr(6,2);
|
|
|
return new Date(y,m-1,d);
|
|
|
}
|
|
|
|
|
|
function generateQRCodes() {
|
|
|
gtag('event', 'generateQR');
|
|
|
|
|
|
// Where to Download the public key
|
|
|
const pubKeyLink = e("qr-link").value.trim().replace("http://","");
|
|
|
|
|
|
// PEM code of the private key
|
|
|
const priKeyPEM = e('privkey').value;
|
|
|
|
|
|
// Where to Download the public key
|
|
|
const pubKeyIdDivoc = e("pubKeyIdDivoc").value;
|
|
|
const privkeyDivoc = e('privkeyDivoc').value;
|
|
|
const pubKeyDivoc = e('pubKeyDivoc').value;
|
|
|
|
|
|
const fieldArray = [
|
|
|
"qr-pat-id", "qr-pat-refid", "qr-pat-name", "qr-pat-age", "qr-pat-gender", "qr-pat-nationality",
|
|
|
"qr-location-address1", "qr-location-address2", "qr-location-district", "qr-location-city", "qr-location-zip", "qr-location-state", "qr-location-country",
|
|
|
"qr-immunization-date", "qr-immunization-manuf", "qr-immunization-product", "qr-immunization-lot", "qr-immunization-eff-start", "qr-immunization-eff-end",
|
|
|
"qr-immunization-dose", "qr-immunization-total-doses", "qr-immunization-id", "qr-immunization-verifier",
|
|
|
"qr-facility-name", "qr-facility-address1", "qr-facility-address2", "qr-facility-district", "qr-facility-city", "qr-facility-zip", "qr-facility-state", "qr-facility-country",
|
|
|
"qr-head-issuance-date",
|
|
|
];
|
|
|
|
|
|
signAndDisplayQR("qr-divoc", "cowin", "1", priKeyPEM, pubKeyLink, getValueArray(fieldArray));
|
|
|
|
|
|
let divocW3C = {
|
|
|
"@context": e("qr-head-context").value.split(', '),
|
|
|
"type": e("qr-head-type").value.split(', '),
|
|
|
"issuer": e("qr-head-issuer").value,
|
|
|
"issuanceDate": parse(e("qr-head-issuance-date").value).toJSON(),
|
|
|
"nonTransferable": e("qr-head-nontransfer").value,
|
|
|
"credentialSubject": {
|
|
|
"type": e("qr-pat-type").value,
|
|
|
"id": e("qr-pat-id").value,
|
|
|
"refId": e("qr-pat-refid").value,
|
|
|
"name": e("qr-pat-name").value,
|
|
|
"gender": e("qr-pat-gender").value,
|
|
|
"age": e("qr-pat-age").value,
|
|
|
"nationality": e("qr-pat-nationality").value,
|
|
|
"address": {
|
|
|
"streetAddress": e("qr-location-address1").value,
|
|
|
"streetAddress2": e("qr-location-address2").value,
|
|
|
"district": e("qr-location-district").value,
|
|
|
"city": e("qr-location-city").value,
|
|
|
"addressRegion": e("qr-location-state").value,
|
|
|
"addressCountry": e("qr-location-country").value,
|
|
|
"postalCode": e("qr-location-zip").value,
|
|
|
}
|
|
|
},
|
|
|
"evidence": [
|
|
|
{
|
|
|
"id": "https://cowin.gov.in/vaccine/" + e("qr-immunization-id").value,
|
|
|
"feedbackUrl": "https://cowin.gov.in/?" + e("qr-immunization-id").value,
|
|
|
"infoUrl": "https://cowin.gov.in/?" + e("qr-immunization-id").value,
|
|
|
"type": [e("qr-immunization-type").value],
|
|
|
"batch": e("qr-immunization-lot").value,
|
|
|
"vaccine": e("qr-immunization-product").value,
|
|
|
"manufacturer": e("qr-immunization-manuf").value,
|
|
|
"date": e("qr-immunization-date").value,
|
|
|
"effectiveStart": e("qr-immunization-eff-start").value,
|
|
|
"effectiveUntil": e("qr-immunization-eff-end").value,
|
|
|
"dose": e("qr-immunization-dose").value,
|
|
|
"totalDoses": e("qr-immunization-total-doses").value,
|
|
|
"verifier": {
|
|
|
"name": e("qr-immunization-verifier").value
|
|
|
},
|
|
|
"facility": {
|
|
|
"name": e("qr-facility-name").value,
|
|
|
"address": {
|
|
|
"streetAddress": e("qr-facility-address1").value,
|
|
|
"streetAddress2": e("qr-facility-address2").value,
|
|
|
"district": e("qr-facility-district").value,
|
|
|
"city": e("qr-facility-city").value,
|
|
|
"addressRegion": e("qr-facility-state").value,
|
|
|
"addressCountry": e("qr-facility-country").value,
|
|
|
"postalCode": e("qr-facility-zip").value,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
|
|
|
DIVOC.sign(divocW3C, privkeyDivoc, pubKeyDivoc).then(cert => {
|
|
|
DIVOC.pack(cert).then(packed => {
|
|
|
UIUtils.drawsQR("qr-divoc-orig", packed);
|
|
|
e("qr-divoc-orig-result").innerHTML = packed;
|
|
|
DIVOC.unpackAndVerify(packed, pubKeyDivoc).then(verified => {
|
|
|
if (verified) {
|
|
|
const imgDim={width:50,height:50};
|
|
|
var context = e('qr-divoc-orig-code').getContext('2d');
|
|
|
var imageObj = new Image();
|
|
|
imageObj.src = './img/ok-256.png';
|
|
|
imageObj.onload = function() {
|
|
|
context.drawImage(imageObj,
|
|
|
e('qr-divoc-orig-code').width / 2 - imgDim.width / 2 +1,
|
|
|
e('qr-divoc-orig-code').height / 2 - imgDim.height / 2,imgDim.width,imgDim.height);
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
e("qr-divoc-orig-result").setAttribute('data-title', JSON.stringify(cert));
|
|
|
});
|
|
|
|
|
|
e("qr-divoc-orig-code").style.display='block';
|
|
|
e("qr-divoc-orig-result").style.display='block';
|
|
|
}
|
|
|
|
|
|
function copyToClipboard() {
|
|
|
navigator.permissions.query({name: "clipboard-write"}).then(result => {
|
|
|
if (result.state == "granted" || result.state == "prompt") {
|
|
|
var copyText = e("qr-divoc-orig-result").getAttribute('data-title');
|
|
|
navigator.clipboard.writeText(copyText);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function verifyQRCode() {
|
|
|
gtag('event', 'verifyQR');
|
|
|
const payload = e("qr-verify").value;
|
|
|
if (payload.startsWith("CRED:")) {
|
|
|
PCFUtils.debugParseURI(e("qr-verify").value).then(result => {
|
|
|
e("qr-verify-result").innerHTML = result;
|
|
|
});
|
|
|
PCFUtils.debugVerify(e("qr-verify").value).then(debug => {
|
|
|
e('qr-verify-verified').innerHTML = debug;
|
|
|
});
|
|
|
} if (payload.startsWith("{")) {
|
|
|
DIVOC.verify(JSON.parse(payload)).then(verified => {
|
|
|
e("qr-verify-result").innerHTML = "W3C VC Payload";
|
|
|
e("qr-verify-verified").innerHTML = "Signature: " + (verified ? "Verified" : "Not Valid");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
// Defaults
|
|
|
e("qr-immunization-date").value = new Date().toJSON().slice(0, 10).replaceAll("-","");
|
|
|
|
|
|
function loadDemo() {
|
|
|
e("qr-head-context").value = "https://www.w3.org/2018/credentials/v1, https://cowin.gov.in/credentials/vaccination/v1";
|
|
|
e("qr-head-issuance-date").value = new Date().toJSON().slice(0, 10).replaceAll("-","");
|
|
|
e("qr-head-type").value = "VerifiableCredential, ProofOfVaccinationCredential";
|
|
|
e("qr-head-issuer").value = "https://cowin.gov.in/";
|
|
|
e("qr-head-nontransfer").value = "true";
|
|
|
|
|
|
e("qr-pat-type").value = "Person";
|
|
|
e("qr-pat-id").value = "did:in.gov.uidai.aadhaar:2342343334";
|
|
|
e("qr-pat-refid").value = "12346";
|
|
|
e("qr-pat-name").value = "Bhaya Mitra";
|
|
|
e("qr-pat-age").value = "27";
|
|
|
e("qr-pat-gender").value = "Male";
|
|
|
e("qr-pat-nationality").value = "Indian";
|
|
|
|
|
|
e("qr-location-address1").value = "101-102, Mangal Ashirwad";
|
|
|
e("qr-location-address2").value = "S V Road";
|
|
|
e("qr-location-district").value = "Santacruz West";
|
|
|
e("qr-location-city").value = "Mumbai";
|
|
|
e("qr-location-zip").value = "400054";
|
|
|
e("qr-location-state").value = "Maharashtra";
|
|
|
e("qr-location-country").value = "IN";
|
|
|
|
|
|
e("qr-immunization-id").value = "";
|
|
|
e("qr-immunization-type").value = "Vaccination";
|
|
|
e("qr-immunization-manuf").value = "COVPharma";
|
|
|
e("qr-immunization-product").value = "CoVax";
|
|
|
e("qr-immunization-lot").value = "MB3428BX";
|
|
|
e("qr-immunization-eff-start").value = "20201202";
|
|
|
e("qr-immunization-eff-end").value = "20251202";
|
|
|
e("qr-immunization-dose").value = "1";
|
|
|
e("qr-immunization-total-doses").value = "1";
|
|
|
e("qr-immunization-verifier").value = "Sooraj Singh";
|
|
|
|
|
|
e("qr-facility-name").value = "ABC Medical Center";
|
|
|
e("qr-facility-address1").value = "123, Koramangala";
|
|
|
e("qr-facility-address2").value = "";
|
|
|
e("qr-facility-district").value = "Bengaluru South";
|
|
|
e("qr-facility-city").value = "Bengaluru";
|
|
|
e("qr-facility-zip").value = "";
|
|
|
e("qr-facility-state").value = "Karnataka";
|
|
|
e("qr-facility-country").value = "IN";
|
|
|
}
|
|
|
|
|
|
loadDemo();
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
async function preloadKey() {
|
|
|
CRED.resolveKey(e("qr-link").value);
|
|
|
}
|
|
|
window.onload = function() {
|
|
|
preloadKey();
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|
|
|
|
|
|
|