diff --git a/.tx/config b/.tx/config index 95c0e8d..582c055 100644 --- a/.tx/config +++ b/.tx/config @@ -9,14 +9,6 @@ file_filter = po/hagrid/.po trans.zh-Hans = po/hagrid/zh_Hans.po type = PO -[hagrid.about-proofs] -minimum_perc = 100 -source_file = templates-untranslated/about/proofs.html.hbs -file_filter = templates-translated//about/proofs.html.hbs -trans.zh-Hans = templates-translated/zh_Hans/about/proofs.html.hbs -source_lang = en -type = HTML - [hagrid.about-about] minimum_perc = 100 source_file = templates-untranslated/about/about.html.hbs diff --git a/dist/assets/img/certificate.svg b/dist/assets/img/certificate.svg deleted file mode 100644 index 0738c25..0000000 --- a/dist/assets/img/certificate.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/envelope.svg b/dist/assets/img/envelope.svg deleted file mode 100644 index edbcad3..0000000 --- a/dist/assets/img/envelope.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/github.png b/dist/assets/img/github.png deleted file mode 100644 index 6723d81..0000000 Binary files a/dist/assets/img/github.png and /dev/null differ diff --git a/dist/assets/img/github.svg b/dist/assets/img/github.svg deleted file mode 100644 index 53bd7b2..0000000 --- a/dist/assets/img/github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/globe.svg b/dist/assets/img/globe.svg deleted file mode 100644 index 93b6178..0000000 --- a/dist/assets/img/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/hackernews.svg b/dist/assets/img/hackernews.svg deleted file mode 100644 index 0de37e6..0000000 --- a/dist/assets/img/hackernews.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/key.svg b/dist/assets/img/key.svg deleted file mode 100644 index e0bd494..0000000 --- a/dist/assets/img/key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/mastodon.svg b/dist/assets/img/mastodon.svg deleted file mode 100644 index bb7c428..0000000 --- a/dist/assets/img/mastodon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/reddit.svg b/dist/assets/img/reddit.svg deleted file mode 100644 index 262d0a7..0000000 --- a/dist/assets/img/reddit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/js/proofs.js b/dist/assets/js/proofs.js deleted file mode 100644 index c39a5f0..0000000 --- a/dist/assets/js/proofs.js +++ /dev/null @@ -1,295 +0,0 @@ -(async function() { - function getVerifier(proofs, proofUrl, fingerprint) { - for (const proof of proofs) { - // check if the proof URI matches one of our known definitions - const matches = proofUrl.match(new RegExp(proof.matcher)); - if (!matches) continue; - - // get all variables that were matched from the URI - const bound = Object.entries(proof.variables) - .map(([key, value]) => [key, matches[value || 0]]) - .reduce((previous, current) => { - previous[current[0]] = current[1]; - return previous; - }, { FINGERPRINT: fingerprint }); - - // replacer function that will substitute variables in text - const replace = text => text.replace(/\{([A-Z]+)\}/g, (_, name) => bound[name]); - - // return description of what we matched including extracted data - return { - profile: [proof.profile, replace(proof.profile)], - proofUrl, - proofJson: [proof.proof, replace(proof.proof)], - username: [proof.username, replace(proof.username)], - service: proof.service, - checks: (proof.checks || []).map(check => ({ - relation: check.relation, - proof: check.proof, - claim: check.claim.replace(/\{([A-Z]+)\}/g, (_, name) => bound[name]) - })), - matcher: proof.matcher, - variables: Object.entries(proof.variables).map(entry => (entry[2] = matches[entry[1]], entry)) - }; - } - // no match - return null; - } - - const email = location.href.split('/').pop(); - const keyUrl = "/vks/v1/by-email/" + email; - const response = await fetch(keyUrl); - const armor = await response.text(); - const key = (await openpgp.key.readArmored(armor)).keys[0]; - - // add fingerprint header - const fingerprint = key.primaryKey.getFingerprint(); - - const fprLink = document.querySelector('.fpr'); - fprLink.href = keyUrl; - fprLink.firstElementChild.textContent = fingerprint; - - // verify primary user to use in the profile name - const primaryUser = await key.getPrimaryUser(); - - if (!await primaryUser.user.verify(key.primaryKey)) { - throw new Error('Primary user is not valid.'); - } - - document.title = primaryUser.user.userId.name + ' — ' + document.title; - const name = primaryUser.user.userId.name; - document.querySelector('.name').textContent = name; - - // grab avatar from MD5 of primary user's e-mail address - const util = openpgp.util; - const digest = await openpgp.crypto.hash.md5(util.str_to_Uint8Array(email)); - const profileHash = util.str_to_hex(util.Uint8Array_to_str(digest)); - - document.querySelector('.avatar').src = `https://www.gravatar.com/avatar/${profileHash}?s=148&d=mm`; - - // we support reading proof URIs from these notations - const supportedNotations = ['proof@metacode.biz', 'proof@keys.openpgp.org']; - const proofDefinitions = (await (await fetch('/assets/proofs.json')).json()).proofs; - - // proof URLs are gathered from all UIDs and sorted by insertion order - const proofUrls = new Set(); - const emails = new Set([email]); - - for (const user of key.users) { - // if verification fails for the User ID still continue with others - try { - const valid = await user.verify(key.primaryKey); - // validate the User ID to avoid issues like: - // https://bitbucket.org/skskeyserver/sks-keyserver/issues/41 - if (valid) { - // get latest self-certification - const cert = user.selfCertifications.reduce((a, b) => a.created > b.created ? a : b); - (cert.notations || []) - // filter out non-supported notations - .filter(notation => supportedNotations.includes(notation[0]) && typeof notation[1] === 'string') - // select only values (proof URIs) - .map(notation => notation[1]) - .forEach(proofUrls.add.bind(proofUrls)); - - // add proof links from User Attributes too - // this won't work on Hagrid as Hagrid never exposes User Attributes currently (2020-07-09) - // but would work on a custom page - if (user.userAttribute && user.userAttribute.attributes[0][0] === 'e') { - proofUrls.add(user.userAttribute.attributes[0].substring(user.userAttribute.attributes[0].indexOf('@') + 1)); - } - if (user.userId && user.userId.email) { - emails.add(user.userId.email); - } - } - } catch (e) { - console.error('User verification error:', e); - } - } - - // add e-mails to the UI - function addEmail(email) { - const li = document.createElement('li'); - const keyLink = document.createElement('a'); - keyLink.href = 'mailto:' + email; - keyLink.textContent = email; - keyLink.className = 'email'; - li.appendChild(keyLink); - return li; - } - - for (const email of emails) { - document.querySelector('.info').appendChild(addEmail(email)); - } - - // get text to be rendered, this could be improved by using