Merge pull request 'Update proof verification JS to be case insensitive in more tests' (#7) from screenbeard/keyoxide:fingerprint-verification-fixes into dev

Reviewed-on: https://codeberg.org/yarmo/keyoxide/pulls/7
This commit is contained in:
yarmo 2020-07-05 13:21:26 +02:00
commit 3362f8a071
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]