Allow notations from all UIDs

This commit is contained in:
Yarmo Mackenbach 2020-08-15 00:48:48 +02:00
parent d25d592bef
commit d241e9b5d3

View file

@ -188,12 +188,18 @@ async function verifyProofs(opts) {
return; return;
} }
let notations = [];
for (var i = 0; i < keyData.publicKey.users.length; i++) {
notations = notations.concat(keyData.publicKey.users[i].selfCertifications[0].notations);
}
notations = Array.from(new Set(notations)); // Deduplicate (ES6)
// Display feedback // Display feedback
elRes.innerHTML = "Verifying proofs&hellip;"; elRes.innerHTML = "Verifying proofs&hellip;";
let notation, isVerified, verifications = []; let notation, isVerified, verifications = [];
for (var i = 0; i < keyData.notations.length; i++) { for (var i = 0; i < notations.length; i++) {
notation = keyData.notations[i]; notation = notations[i];
if (notation[0] != "proof@metacode.biz") { continue; } if (notation[0] != "proof@metacode.biz") { continue; }
verifications.push(await verifyProof(notation[1], keyData.fingerprint)); verifications.push(await verifyProof(notation[1], keyData.fingerprint));
} }
@ -233,10 +239,17 @@ async function displayProfile(opts) {
document.body.querySelector('#profileName').innerHTML = "Could not load profile"; document.body.querySelector('#profileName').innerHTML = "Could not load profile";
return; return;
} }
let userData = keyData.user.user.userId; let userData = keyData.user.user.userId;
let userName = userData.name ? userData.name : userData.email; let userName = userData.name ? userData.name : userData.email;
let userMail = userData.email ? userData.email : null; let userMail = userData.email ? userData.email : null;
let notations = [];
for (var i = 0; i < keyData.publicKey.users.length; i++) {
notations = notations.concat(keyData.publicKey.users[i].selfCertifications[0].notations);
}
notations = Array.from(new Set(notations)); // Deduplicate (ES6)
// Determine WKD or HKP link // Determine WKD or HKP link
switch (opts.mode) { switch (opts.mode) {
case "wkd": case "wkd":
@ -320,7 +333,7 @@ async function displayProfile(opts) {
// feedback += `</div>`; // feedback += `</div>`;
// } // }
if (keyData.notations.length > 0) { if (notations.length > 0) {
feedback += `<div class="profileDataItem profileDataItem--separator profileDataItem--noLabel">`; feedback += `<div class="profileDataItem profileDataItem--separator profileDataItem--noLabel">`;
feedback += `<div class="profileDataItem__label"></div>`; feedback += `<div class="profileDataItem__label"></div>`;
feedback += `<div class="profileDataItem__value">proofs</div>`; feedback += `<div class="profileDataItem__value">proofs</div>`;
@ -351,14 +364,14 @@ async function displayProfile(opts) {
document.body.querySelector('#profileData').innerHTML = feedback; document.body.querySelector('#profileData').innerHTML = feedback;
// Exit if no notations are available // Exit if no notations are available
if (keyData.notations.length == 0) { if (notations.length == 0) {
return; return;
} }
// Verify identity proofs // Verify identity proofs
let proofResult; let proofResult;
for (var i = 0; i < keyData.notations.length; i++) { for (var i = 0; i < notations.length; i++) {
notation = keyData.notations[i]; notation = notations[i];
if (notation[0] != "proof@metacode.biz") { continue; } if (notation[0] != "proof@metacode.biz") { continue; }
proofResult = await verifyProof(notation[1], keyData.fingerprint); proofResult = await verifyProof(notation[1], keyData.fingerprint);
if (!proofResult || !proofResult.display) { continue; } if (!proofResult || !proofResult.display) { continue; }