diff --git a/assets/scripts.js b/assets/scripts.js index 19ea2fd..93c263a 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -165,7 +165,30 @@ async function verifyProofs(opts) { // Display feedback elRes.innerHTML = feedback; -}; +} + +async function displayProfile(opts) { + let keyData = await fetchKeys(opts); + let userData = keyData.user.user.userId; + let feedback = "", notation, isVerified, verifications = []; + + document.body.querySelector('#profile--name').innerHTML = userData.name; + document.body.querySelector('#profile--email').innerHTML = userData.email; + + for (var i = 0; i < keyData.notations.length; i++) { + notation = keyData.notations[i]; + if (!(notation[0] == "proof@keyoxide.org" || notation[0] == "proof@metacode.biz")) { continue; } + verifications.push(await verifyProof(notation[1], keyData.fingerprint)); + } + + // Generate feedback + for (var i = 0; i < verifications.length; i++) { + feedback += `${verifications[i].type}: ${verifications[i].display}: ${verifications[i].isVerified}
`; + } + + // Display feedback + document.body.querySelector('#profile--proofs').innerHTML = feedback; +} async function verifyProof(url, fingerprint) { // Init @@ -385,8 +408,9 @@ async function fetchKeys(opts) { // General purpose let elFormVerify = document.body.querySelector("#form-verify"), - elFormEncrypt = document.body.querySelector("#form-encrypt"); - elFormProofs = document.body.querySelector("#form-proofs"); + elFormEncrypt = document.body.querySelector("#form-encrypt"), + elFormProofs = document.body.querySelector("#form-proofs"), + elProfileUid = document.body.querySelector("#profileUid"); if (elFormVerify) { elFormVerify.onsubmit = function (evt) { @@ -474,3 +498,12 @@ if (elFormProofs) { verifyProofs(opts); }; } + +if (elProfileUid) { + let profileUid = elProfileUid.innerHTML; + let opts = { + input: profileUid, + mode: "hkp" + } + displayProfile(opts); +} diff --git a/pages/profile.html b/pages/profile.html index 7ca142e..bad9642 100644 --- a/pages/profile.html +++ b/pages/profile.html @@ -12,19 +12,17 @@
Keyoxide -
-

Profile

-

%UID%

+

+

Input: %UID%

+

Name:

+

Email address: /span>

+

Proofs: /span>