Skip to content

Commit

Permalink
fix wasm init for pub intro
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Nov 27, 2023
1 parent c0d29c9 commit 2501c4b
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions lib/docs/demo.html
Expand Up @@ -151,22 +151,24 @@ <h1 class="text-xl font-semibold">Nanopublication signing demo</h1>
// Generate key pair and publish Nanopub intro
const introBtn = document.getElementById('publish-intro-btn')
introBtn.addEventListener('click', (event) => {
const keypair = new KeyPair()
const profile = new NpProfile(orcidToken.orcid, orcidToken.fullName, keypair.private, "");
// Publish nanopub link to public key
const intro = Nanopub.publish_intro(profile, getNpServer(false))
.then(np => {
rdfOutput.textContent = np.get_rdf();
console.log("Published Introduction Nanopub:", np.toString());
// Display private key
document.getElementById("privkey-card").classList.remove("hidden");
document.getElementById("display-privkey").textContent = keypair.private
hljs.highlightAll();
})
.catch(error => {
rdfOutput.textContent = error;
console.error("Publishing error:", error);
});
init().then(() => {
const keypair = new KeyPair()
const profile = new NpProfile(orcidToken.orcid, orcidToken.fullName, keypair.private, "");
// Publish nanopub link to public key
const intro = Nanopub.publish_intro(profile, getNpServer(false))
.then(np => {
rdfOutput.textContent = np.get_rdf();
console.log("Published Introduction Nanopub:", np.toString());
// Display private key
document.getElementById("privkey-card").classList.remove("hidden");
document.getElementById("display-privkey").textContent = keypair.private
hljs.highlightAll();
})
.catch(error => {
rdfOutput.textContent = error;
console.error("Publishing error:", error);
});
});
});

// Setup ORCID login https://github.com/ORCID/orcid-openid-examples/blob/master/js-widget/readme.md
Expand Down

0 comments on commit 2501c4b

Please sign in to comment.