Update proof verification JS to be case insensitive in more tests

Update Reddit guide to remove mention of Twitter
This commit is contained in:
screenbeard 2020-07-05 11:57:14 +09:30
parent 16ab2f640f
commit af3fc8d5da
No known key found for this signature in database
GPG key ID: 3AB72AFE4AF4C7A4
2 changed files with 5 additions and 5 deletions

View file

@ -361,7 +361,7 @@ async function verifyProof(url, fingerprint) {
throw new Error('Response failed: ' + response.status);
}
json = await response.json();
reVerify = new RegExp(`openpgp4fpr:${fingerprint}`);
reVerify = new RegExp(`openpgp4fpr:${fingerprint}`, 'i');
json.Answer.forEach((item, i) => {
if (reVerify.test(item.data)) {
output.isVerified = true;
@ -413,7 +413,7 @@ async function verifyProof(url, fingerprint) {
throw new Error('Response failed: ' + response.status);
}
json = await response.json();
reVerify = new RegExp(`openpgp4fpr:${fingerprint}`);
reVerify = new RegExp(`openpgp4fpr:${fingerprint}`, 'i');
if (reVerify.test(json.about)) {
output.isVerified = true;
}
@ -464,7 +464,7 @@ async function verifyProof(url, fingerprint) {
throw new Error('Response failed: ' + response.status);
}
json = await response.json();
reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`);
reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`, 'i');
if (reVerify.test(json.files["openpgp.md"].content)) {
output.isVerified = true;
}
@ -518,7 +518,7 @@ async function verifyProof(url, fingerprint) {
// Potentially Mastodon
match = url.match(/https:\/\/(.*)\/@(.*)/);
json.attachment.forEach((item, i) => {
if (item.value === fingerprint) {
if (item.value.toUpperCase() === fingerprint.toUpperCase()) {
output.type = "mastodon";
output.display = `@${match[2]}@${[match[1]]}`;
output.proofUrlFetch = json.url;

View file

@ -2,7 +2,7 @@
<h3>Post a Reddit proof message</h3>
<p>Log in to <a href="https://www.reddit.com">www.reddit.com</a> and compose a new tweet with the following text (make sure to replace FINGERPRINT):</p>
<p>Log in to <a href="https://www.reddit.com">www.reddit.com</a> and create a new post with the following text (make sure to replace FINGERPRINT):</p>
<code>This is an OpenPGP proof that connects my OpenPGP key to this Reddit account.
For details check out https://keyoxide.org/guides/openpgp-proofs
<br><br>[Verifying my OpenPGP key: openpgp4fpr:FINGERPRINT]