1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-14 14:48:53 +09:00
cherrypick/src/remote/webfinger.ts
2019-01-31 17:52:17 +09:00

24 lines
454 B
TypeScript

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