We have a web page with an embedded blockcerts-verifier web component (https://github.com/blockchain-certificates/blockcerts-verifier) . We’d like to allow passing a certificate url to the page (as a url param), and have the verifier immediately open the associated cert. So, we want a url like:
http://mypage.ca/validator?url=http://certhoster.ca/myblockCert.json
that will immediately open that cert in the verifier when the page is loaded.
Has anyone done this, or can anyone recommend an approach?
Thank you.
My feeling is that the certs should be encrypted with the verifier’s public key, and not passed in the clear. Interested to hear other thoughts on this topic.
Hi @jc.chartrand,
Provided the verifier will be on the http://mypage.ca/validator page, and you have access to the way it’s generated, you could very much pass the cert link to the blockcerts verifier directly via the src
option of the API: https://github.com/blockchain-certificates/blockcerts-verifier#api
<blockcerts-verifier src='http://certhoster.ca/myblockCert.json'></blockcerts-verifier>
Thanks, yes, that’s what we plan to do. Here in fact is working javascript (for anyone else wanting to do the same):
<html>
<head>
<script src="./custom-elements-es5-adapter.js"></script>
<script src="./webcomponents-loader.js"></script>
<script type="module" src="./ie11.js"></script>
</head>
<body>
<div id="validatorPane"></div>
<script>
var element = document.createElement('blockcerts-verifier')
element.setAttribute('display-mode', 'full')
const params = new Map(location.search.slice(1).split('&').map(paramPair => paramPair.split('=')))
if (params.has('url')) {
let url = decodeURI(params.get('url'))
element.setAttribute('src', url )
}
document.getElementById('validatorPane').appendChild(element)
</script>
</body>
</html>