Commit 0341abf3 authored by taco@waag.org's avatar taco@waag.org
Browse files

portable demo

parent dbd5d208
This is a modified version of the irma-frontend example, for more information see:
## what is this?
index.hml is a minimal example of pop-signing (v0) using pop.js and irma.js.
it is based off the irma-frontend example, for more information see:
https://irma.app/docs/getting-started/#example-configuration-and-irma-session
What it does:
- 1. removes tags from the input textarea message using the browser's textContent function.
- 2. creates a signing request with pdbf.email to irma.snotolf.waag.org for the normalized message, shows QR code in popup
- ... IRMA magic ...
- 3. parses the response, takes the signature, strips the message and base64 encodes what's left
- 4. shows the encoded signature in the bottom textarea
a prebuilt distribution of [irma.js](https://github.com/privacybydesign/irma-frontend-packages/tree/master/irma-frontend) (version 0.4.3) is included.
the example points to the pop irma server running at https://pop.waag.org
## to try it out
an interactive version of this repo is hosted on https://snotolf.waag.org/pop/outbound.html
......@@ -4,9 +4,9 @@
<head>
<title>IRMA web frontend example</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="node_modules/@privacybydesign/irma-frontend/dist/irma.js"></script>
<meta charset="UTF-8">
<script type="text/javascript" src="irma.js"></script>
<script type="text/javascript" src="pop.js"></script>
<style>
......@@ -37,26 +37,26 @@
<script type="text/javascript">
document.getElementById('start-popup').onclick = () => {
//1. normalize using pop library function
let normalized_text = pop_normalize(document.getElementById("message").value);
document.getElementById("message").value = normalized_text;
//2. sign the normalized text using specified server and attribute
pop_sign("https://irma.snotolf.waag.org",
"pbdf.sidn-pbdf.email.email",
normalized_text)
.then( result => {
//3. show the result
document.getElementById("result").value = result;
}).catch(error => {
if (error === 'Aborted') {
console.log('We closed it ourselves, so no problem 😅');
return;
}
console.error("Couldn't do what you asked 😢", error);
});
document.getElementById('start-popup').onclick = () => {
//1. normalize using pop library function
let normalized_text = pop_normalize(document.getElementById("message").value);
document.getElementById("message").value = normalized_text;
//2. sign the normalized text
pop_sign("https://pop.waag.org",
"pbdf.sidn-pbdf.email.email",
normalized_text)
.then( result =>{
//3. show the result
document.getElementById("result").value = result;
}).catch(error => {
if (error === 'Aborted') {
console.log('We closed it ourselves, so no problem 😅');
return;
}
console.error("Couldn't do what you asked 😢", error);
})
};
</script>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,6 @@ function pop_normalize(raw){
function pop_sign(url, attribute, message){
let normalized_message = pop_normalize(message);
let options = {
// Developer options
debugging: true,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment