mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
Reorder XMPP proof
This commit is contained in:
parent
922738238b
commit
d070ed0864
1 changed files with 23 additions and 23 deletions
|
@ -386,6 +386,29 @@ async function verifyProof(url, fingerprint) {
|
|||
return output;
|
||||
}
|
||||
}
|
||||
// XMPP
|
||||
if (/^xmpp:/.test(url)) {
|
||||
output.type = "xmpp";
|
||||
console.log(url);
|
||||
match = url.match(/xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/);
|
||||
console.log(match);
|
||||
output.display = `${match[1]}@${match[2]}`;
|
||||
output.proofUrl = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`;
|
||||
try {
|
||||
response = await fetch(output.proofUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error('Response failed: ' + response.status);
|
||||
}
|
||||
json = await response.json();
|
||||
reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`, 'i');
|
||||
if (reVerify.test(json)) {
|
||||
output.isVerified = true;
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
// Twitter
|
||||
if (/^https:\/\/twitter.com/.test(url)) {
|
||||
output.type = "twitter";
|
||||
|
@ -532,29 +555,6 @@ async function verifyProof(url, fingerprint) {
|
|||
return output;
|
||||
}
|
||||
}
|
||||
// XMPP
|
||||
if (/^xmpp:/.test(url)) {
|
||||
output.type = "xmpp";
|
||||
console.log(url);
|
||||
match = url.match(/xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/);
|
||||
console.log(match);
|
||||
output.display = `${match[1]}@${match[2]}`;
|
||||
output.proofUrl = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`;
|
||||
try {
|
||||
response = await fetch(output.proofUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error('Response failed: ' + response.status);
|
||||
}
|
||||
json = await response.json();
|
||||
reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`, 'i');
|
||||
if (reVerify.test(json)) {
|
||||
output.isVerified = true;
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
// Catchall
|
||||
// Fediverse
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue