tangled
alpha
login
or
join now
yoyle.city
/
skittr
6
fork
atom
this repo has no description
atproto
bluesky
typescript
express
6
fork
atom
overview
issues
3
pulls
pipelines
com.atproto.identity.resolveDid in skittr appview!
lime360
4 months ago
39908983
3182eb25
1/1
test.yml
success
24s
+28
-3
1 changed file
expand all
collapse all
unified
split
src
routes
appview.ts
+28
-3
src/routes/appview.ts
···
1
1
import { Router, Request, Response } from "express";
2
2
-
import { byDNS, byHTTP } from "../lib/resolver.js";
2
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
18
-
// todo: resolve handles from both DNS and HTTP
19
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
38
+
});
39
39
+
},
40
40
+
);
41
41
+
42
42
+
api.get(
43
43
+
"/com.atproto.identity.resolveDid",
44
44
+
async (req: Request, res: Response) => {
45
45
+
const did = req.query.did as string;
46
46
+
47
47
+
if (!did) {
48
48
+
return res.status(400).json({
49
49
+
error: "InvalidRequest",
50
50
+
message: "DID not found",
51
51
+
});
52
52
+
}
53
53
+
54
54
+
const didDoc = await byPLC(did);
55
55
+
56
56
+
if (!didDoc) {
57
57
+
return res.status(400).json({
58
58
+
error: "DidNotFound",
59
59
+
message: "DID document not found",
60
60
+
});
61
61
+
}
62
62
+
63
63
+
res.json({
64
64
+
didDoc: didDoc,
40
65
});
41
66
},
42
67
);