diff --git a/index.html b/index.html
index 3f0c8a8..f36c7da 100644
--- a/index.html
+++ b/index.html
@@ -4,6 +4,7 @@
SPDX-License-Identifier: BSD-3-Clause
-->
+
+
+
Issued by:
+
+
Selectively Disclosed Credential:
+
+
+
+ The outer/Wallet HTML uses
+
CSP set in its
+
<meta> tag to prevent the use of an
+
src attribute being used (i.e., "frame-src 'none'").
+ Consequently, clicking the following link will result in an error
+ (i.e., it won't hit the server at all):
+
+
+
+
- // start message queue for channel port
- port.start();
- // handle messages from parent
- port.onmessage = event => {
- const {jsonrpc, method, params} = event.data;
- if(!(jsonrpc === '2.0' &&
- typeof method === 'string' &&
- Array.isArray(params))) {
- throw new Error('Unknown message format.');
- }
- const [options] = params;
- if(method === 'render') {
- render(options);
- return;
- }
- throw new Error(\`Unknown RPC method "\${method}".\`);
- };
-});
-
-function render({credential, template} = {}) {
- if(!(credential && typeof credential === 'object')) {
- throw new TypeError('"credential" must be an object.');
- }
- if(!(template && typeof template === 'string')) {
- throw new TypeError('"template" must be a string.');
- }
- console.log('injecting');
+
+ ${template}
+
+ `;
- // inject credential into HTML as a script tag
- const script = document.createElement('script');
- // FIXME: use "name" or "id"?
- script.setAttribute('name', 'credential');
- script.type = 'application/ld+json';
- script.innerHTML = JSON.stringify(credential, null, 2);
- document.head.appendChild(script);
- // set template as the new HTML body using "createContextualFragment" to
- // ensure any scripts execute; a script in the template must call
- // window.renderMethodReady() to indicate the rendering is ready
- document.body.append(
- document.createRange().createContextualFragment(template));
+ return {iframe, ready: readyPromise};
}
-
-
-
-
-
-