this repo has no description
atproto bluesky typescript express

you can now resolve handles through did documents

+10 -5
+7 -2
src/lib/resolver.ts
··· 51 51 } 52 52 } 53 53 54 - export async function byPLC(did: string, endpoint: string = "https://plc.directory"): Promise<any> { 54 + export async function getPLC(did: string, endpoint: string = "https://plc.directory"): Promise<any> { 55 55 const agent = new Agent({ keepAliveTimeout: 10000 }); 56 56 setGlobalDispatcher(agent); 57 57 ··· 69 69 } 70 70 } 71 71 72 + export async function byPLC(did: string) { 73 + const didDoc = await getPLC(did); 74 + return didDoc.id; 75 + } 76 + 72 77 export async function getPDS(did: string) { 73 - const didDoc = await byPLC(did); 78 + const didDoc = await getPLC(did); 74 79 return didDoc.service[0].serviceEndpoint; 75 80 }
+3 -3
src/routes/appview.ts
··· 1 1 import { Router, Request, Response } from "express"; 2 - import { byDNS, byHTTP, byPLC } from "../lib/resolver.js"; 2 + import { getPLC, byPLC } from "../lib/resolver.js"; 3 3 4 4 const api = Router(); 5 5 ··· 22 22 }); 23 23 } 24 24 25 - const did = await byDNS(handle); 25 + const did = await byPLC(handle); 26 26 27 27 if (!did) { 28 28 return res.status(400).json({ ··· 47 47 }); 48 48 } 49 49 50 - const didDoc = await byPLC(did); 50 + const didDoc = await getPLC(did); 51 51 52 52 if (!didDoc) { 53 53 return res.status(400).json({