1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-13 14:18:12 +09:00
hotomoe/src/remote/webfinger.ts
2018-04-09 04:08:56 +09:00

24 lines
429 B
TypeScript

const WebFinger = require('webfinger.js');
const webFinger = new WebFinger({ });
type ILink = {
href: string;
rel: string;
};
type IWebFinger = {
links: ILink[];
subject: string;
};
export default async function resolve(query): Promise<IWebFinger> {
return await new Promise((res, rej) => webFinger.lookup(query, (error, result) => {
if (error) {
return rej(error);
}
res(result.object);
})) as IWebFinger;
}