Public
Edited
Jan 24, 2023
Insert cell
Insert cell
window.hwcrypto
Insert cell
Buffer = {
const bf = await require('https://bundle.run/buffer@6.0.3')
console.log(bf)
return bf.Buffer;
}
Insert cell
webeid = require('web-eid/web-eid.js')
Insert cell
Insert cell
Insert cell
require('@web-eid/web-eid-library')
Insert cell
{
const lang = navigator.language.substr(0, 2);
const authButton = document.querySelector("#webeid-auth-button");
authButton.addEventListener("click", async () => {
console.log(lang)
//const ver = await webeid.getVersion()
//console.log(ver)
const authToken = await webeid.authenticate("p6BLQYZViGhIwCMu1w27XHfPLmt2ynZg+67f6PYV6Ic=", {lang});
})

}
Insert cell
{
const lang = navigator.language.substr(0, 2);
const authButton = document.querySelector("#webeid-auth-button1");

authButton.addEventListener("click", async () => {
try {
const challengeResponse = await fetch("/auth/challenge", {
method: "GET",
headers: {
"Content-Type": "application/json"
}
});
if (!challengeResponse.ok) {
throw new Error("GET /auth/challenge server error: " +
challengeResponse.status);
}
const {challengeNonce} = await challengeResponse.json();
const authToken = await webeid.authenticate(challengeNonce, {lang});
const authTokenResponse = await fetch("/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
//[csrfHeaderName]: csrfToken
},
body: JSON.stringify({authToken})
});
if (!authTokenResponse.ok) {
throw new Error("POST /auth/login server error: " +
authTokenResponse.status);
}
const authTokenResult = await authTokenResponse.json();
console.log("Authentication successful! Result:", authTokenResult);

window.location.href = "/welcome";

} catch (error) {
console.log("Authentication failed! Error:", error);
throw error;
}
});
}
Insert cell
Insert cell
Insert cell
mhwcrypto = import('https://cdn.skypack.dev/hwcrypto-js@0.0.13?min')
Insert cell
mhwcrypto
Insert cell
import ("https://cdn.skypack.dev/hwcrypto-js")
Insert cell
hwcrypto
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more