From 70486f418c04f3aad81424ce7617a12ea8c56eb4 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 7 Jul 2020 08:14:57 +0200 Subject: [PATCH] Add pleroma identity proof --- CHANGELOG.md | 3 ++- assets/scripts.js | 22 ++++++++++++++++++---- views/guides.php | 1 + views/guides/pleroma.content.php | 30 ++++++++++++++++++++++++++++++ views/guides/pleroma.title.php | 1 + 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 views/guides/pleroma.content.php create mode 100644 views/guides/pleroma.title.php diff --git a/CHANGELOG.md b/CHANGELOG.md index bcf80a5..2dd9df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- Added discourse identity proof +- Discourse identity proof +- Pleroma identity proof ## [0.1.0] - 2020-07-05 ### Added diff --git a/assets/scripts.js b/assets/scripts.js index ec363e1..0787eb5 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -514,7 +514,7 @@ async function verifyProof(url, fingerprint) { output.display = `${match[1]}@${match[2]}`; } // Catchall - // Mastodon + // Fediverse try { response = await fetch(url, { headers: { @@ -530,14 +530,26 @@ async function verifyProof(url, fingerprint) { match = url.match(/https:\/\/(.*)\/@(.*)/); json.attachment.forEach((item, i) => { if (item.value.toUpperCase() === fingerprint.toUpperCase()) { - output.type = "mastodon"; - output.display = `@${match[2]}@${[match[1]]}`; + output.type = "fediverse"; + output.display = `@${json.preferredUsername}@${[match[1]]}`; output.proofUrlFetch = json.url; output.isVerified = true; } }); } - return output; + if (!output.type && 'summary' in json) { + match = url.match(/https:\/\/(.*)\/users\/(.*)/); + reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`, 'i'); + if (reVerify.test(json.summary)) { + output.type = "fediverse"; + output.display = `@${json.preferredUsername}@${[match[1]]}`; + output.proofUrlFetch = json.url; + output.isVerified = true; + } + } + if (output.type) { + return output; + } } catch (e) { console.warn(e); } @@ -568,6 +580,8 @@ async function verifyProof(url, fingerprint) { } catch (e) { console.warn(e); } + + // Return output without confirmed proof return output; } diff --git a/views/guides.php b/views/guides.php index cf0bd9f..9d85f3e 100644 --- a/views/guides.php +++ b/views/guides.php @@ -19,6 +19,7 @@

Adding proofs

Adding a DNS proof
Adding a Mastodon proof
+ Adding a Pleroma proof
Adding a Twitter proof
Adding a Lobste.rs proof
Adding a Hackernews proof
diff --git a/views/guides/pleroma.content.php b/views/guides/pleroma.content.php new file mode 100644 index 0000000..6acfa57 --- /dev/null +++ b/views/guides/pleroma.content.php @@ -0,0 +1,30 @@ +

Let's add a decentralized Pleroma proof to your OpenPGP keys.

+ +

Update the Pleroma account

+ +

Log in to your Pleroma instance and add the following lines to your Bio (make sure to replace FINGERPRINT):

+This is an OpenPGP proof that connects my OpenPGP key to this Pleroma account. +For details check out https://keyoxide.org/guides/openpgp-proofs +

[Verifying my OpenPGP key: openpgp4fpr:FINGERPRINT] +
+ +

Update the PGP key

+ +

First, edit the key (make sure to replace FINGERPRINT):

+gpg --edit-key FINGERPRINT + +

Add a new notation:

+notation + +

Enter the notation (make sure to update the link):

+proof@metacode.biz=https://INSTANCE.ORG/users/@USERNAME + +

Please note that the /users/ part of the URL is mandatory for the proof to work.

+ +

Save the key:

+save + +

Upload the key to WKD or keys.openpgp.org (make sure to replace FINGERPRINT):

+gpg --send-keys FINGERPRINT + +

And you're done! Reload your profile page, it should now show a verified Fediverse account (Pleroma is part of the Fediverse).

diff --git a/views/guides/pleroma.title.php b/views/guides/pleroma.title.php new file mode 100644 index 0000000..62497cb --- /dev/null +++ b/views/guides/pleroma.title.php @@ -0,0 +1 @@ +Adding a pleroma proof