Seeking Advice on OpenCert RenderingMarch 18, 2020 at 2:23am
Hello guys, I would like to seek advice for the rendering of the OpenCert files for an intranet system.
We are not the issuer of the OpenCert document files. However, we require a mean to verify and render the OpenCert document files.
For the verify aspect, I can find in the link: https://docs.opencerts.io/docs/api/verify But I was unable to find any API for the rendering.
Based on the documentation in https://openattestation.com/docs/verifiable-document/document-template We understand that each educational institute can have their own OpenCert templates.
Below are some of the questions that I have. 1) If I do not have the template that the educational institute is using, how can I render their OpenCert file in an intranet system. 2) Is there any API available for the rendering which I can pass the OpenCert document and receive the rendered object? Similar to the Verify API or the demo at the https://opencerts.io/viewer
March 18, 2020 at 3:23am
If I understand your query well, there is nothing we can provide to help you
The verify part is something that is global and can be reused across any OpenCerts The render part is delegated to the issuer => we have no control over the rendering of an OpenCerts. If theere were a generic way to render an OpenCerts that would mean every certificate would be the same.
There is an API for the communication between OpenCerts and the template that renders a document. That means you can eventually create a clone of OpenCerts website that would only render a document. However you would still need to load the renderer from Intranet
You can have a look to this documentation to understand how it works: https://github.com/Open-Attestation/adr/blob/master/decentralised_rendering.md (spoiler we use frame and penpal lib for the communication)
You can have a look into the code => https://github.com/Open-Attestation/decentralized-renderer-react-components/blob/master/src/components/frame/useFrame.ts (that's where the connection is made)
As each institute is likely to use their own unique template for their document, and a renderer may provide 1 to many different templates to display a document.
May I ask if there any way for us to know which template they are using for their OpenCerts document? It is because only the OpenCerts document will be provided to us but not the OpenCerts template.
I am assuming the general flow is as follows: Please correct me if it is incorrect. 1) UPDATE_TEMPLATES 2) RENDER_DOCUMENT 3) SELECT_TEMPLATE 4) PRINT and we do not know the list of templates to provide when calling this action UPDATE_TEMPLATES
The workflow is not correct. The configuration of the template renderer lie within the OpenCerts while the configuration of the templates is within the template renderer:
- Application send RENDER_DOCUMENT to the frame
- The frame reply with the list of template with UPDATE_TEMPLATES
- Application send SELECT_TEMPLATE to display a specific available template
- Application send PRINT to print the content
In OpenCerts we display tabs depending on the contentn of UPDATE_TEMPLATES. UPDATE_TEMPLATES must return you an array of templates, then up to the application to provide the id of the selected template to the frame
If you plan to build a simple app to display template in a frame I suggest you to reuse the library I linked above ( https://github.com/Open-Attestation/decentralized-renderer-react-components) and have a look into OpenCerts code to see how we use it
March 23, 2020 at 6:18am
Hi Nebulis, We have the following questions. Are we correct to assume we are to develop our own decentralized renderer that can render all types of OpenCerts document that have on boarded with OPENCERTS? o If yes, kindly note we do not own the template for rendering the OpenCerts document. o Will those issuers (eg. education institution) share with us the id of the selected template to use? o and will be we notified whatever there are updates to the template?
We do not know the templates beforehand as well. The workflow is as I explained previously:
The workflow is not correct. The configuration of the template renderer lie within the OpenCerts while the configuration of the templates is within the template renderer:Application send RENDER_DOCUMENT to the frameThe frame reply with the list of template with UPDATE_TEMPLATESApplication send SELECT_TEMPLATE to display a specific available templateApplication send PRINT to print the content
You know which templates are available when you receive
UPDATE_TEMPLATES. The id of the available templates are available when you received this "event"
If you want to display OpenCerts in your website, you do indeed need to develop your own renderer (follow the link I shared, there is also an example of how to create your own renderer)