this repo has no description
atproto bluesky typescript express

pds resolver

+11 -6
+2 -5
src/agent.ts
··· 1 1 import { AtpAgent } from "@atproto/api"; 2 - import dotenv from "dotenv"; 3 - 4 - dotenv.config(); 5 2 6 3 // TODO: use a pds instead of bluesky's centralized services 7 4 export const agent = new AtpAgent({ ··· 10 7 11 8 // TODO: use a database instead of the public api endpoint 12 9 export const pubagent = new AtpAgent({ 13 - service: "https://public.api.bsky.app" 14 - }); 10 + service: "https://public.api.bsky.app", 11 + });
+5
src/lib/resolver.ts
··· 74 74 return null; 75 75 } 76 76 } 77 + 78 + export async function getPDS(did: string) { 79 + const didDoc = await byPLC(did); 80 + return didDoc.service[0].serviceEndpoint; 81 + }
+4 -1
src/tests/resolver.test.ts
··· 1 - import { byDNS, byHTTP, byPLC } from "../lib/resolver.js"; 1 + import { byDNS, byHTTP, byPLC, getPDS } from "../lib/resolver.js"; 2 2 3 3 byDNS("yoyle.city").then((result) => console.log("DNS: " + result)); 4 4 byHTTP("yoyle.city").then((result) => console.log("HTTP: " + result)); 5 5 byPLC("did:plc:vro3sykit2gjemuza2pwvxwy").then((result) => 6 6 console.log("PLC: " + JSON.stringify(result)), 7 7 ); 8 + getPDS("did:plc:vro3sykit2gjemuza2pwvxwy").then((result) => 9 + console.log("PDS: " + result), 10 + );