mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Add XMPP proofs
This commit is contained in:
parent
e301ad042c
commit
448aaf3b4d
1 changed files with 15 additions and 0 deletions
|
@ -537,6 +537,21 @@ async function verifyProof(url, fingerprint) {
|
|||
output.type = "xmpp";
|
||||
match = url.match(/xmpp:(.*)@(.*)/);
|
||||
output.display = `${match[1]}@${match[2]}`;
|
||||
output.proofUrlFetch = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`;
|
||||
try {
|
||||
response = await fetch(output.proofUrlFetch);
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue