this repo has no description
atproto bluesky typescript express

com.atproto.identity.resolveDid in skittr appview!

+28 -3
+28 -3
src/routes/appview.ts
··· 1 1 import { Router, Request, Response } from "express"; 2 - import { byDNS, byHTTP } from "../lib/resolver.js"; 2 + import { byDNS, byHTTP, byPLC } from "../lib/resolver.js"; 3 3 4 4 const api = Router(); 5 5 ··· 15 15 api.get( 16 16 "/com.atproto.identity.resolveHandle", 17 17 async (req: Request, res: Response) => { 18 - // todo: resolve handles from both DNS and HTTP 19 - 20 18 const handle = req.query.handle as string; 21 19 22 20 if (!handle) { ··· 37 35 38 36 res.json({ 39 37 did: did, 38 + }); 39 + }, 40 + ); 41 + 42 + api.get( 43 + "/com.atproto.identity.resolveDid", 44 + async (req: Request, res: Response) => { 45 + const did = req.query.did as string; 46 + 47 + if (!did) { 48 + return res.status(400).json({ 49 + error: "InvalidRequest", 50 + message: "DID not found", 51 + }); 52 + } 53 + 54 + const didDoc = await byPLC(did); 55 + 56 + if (!didDoc) { 57 + return res.status(400).json({ 58 + error: "DidNotFound", 59 + message: "DID document not found", 60 + }); 61 + } 62 + 63 + res.json({ 64 + didDoc: didDoc, 40 65 }); 41 66 }, 42 67 );