1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-11 21:28:14 +09:00

Merge pull request #1372 from akihikodaki/misc

Improve WebFinger verification
This commit is contained in:
syuilo 2018-04-02 19:38:47 +09:00 committed by GitHub
commit da36d50cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,14 +20,19 @@ export default async function resolve(query, verifier?: string): Promise<IWebFin
res(result.object);
})) as IWebFinger;
const subject = finger.subject.toLowerCase().replace(/^acct:/, '');
if (verifier) {
if (finger.subject.toLowerCase().replace(/^acct:/, '') !== verifier) {
throw 'WebFinger verfification failed';
if (typeof verifier === 'string') {
if (subject !== verifier) {
throw new Error;
}
return finger;
}
return resolve(finger.subject, finger.subject.toLowerCase());
if (typeof subject === 'string') {
return resolve(subject, subject);
}
throw new Error;
}