tangled
alpha
login
or
join now
edavis.dev
/
bsky-feeds
1
fork
atom
this repo has no description
1
fork
atom
overview
issues
pulls
pipelines
feat: add .well-known/did.json
Eric Davis
1 year ago
1797150d
c4b79810
+37
2 changed files
expand all
collapse all
unified
split
cmd
feedweb
did.go
main.go
+36
cmd/feedweb/did.go
···
1
1
+
package main
2
2
+
3
3
+
import (
4
4
+
"net/http"
5
5
+
6
6
+
"github.com/labstack/echo/v4"
7
7
+
)
8
8
+
9
9
+
const NgrokHostname = "routinely-right-barnacle.ngrok-free.app"
10
10
+
11
11
+
type DidDocument struct {
12
12
+
context []string `json:"@context"`
13
13
+
id string `json:"id"`
14
14
+
services []DidService `json:"service"`
15
15
+
}
16
16
+
17
17
+
type DidService struct {
18
18
+
id string `json:"id"`
19
19
+
serviceType string `json:"type"`
20
20
+
serviceEndpoint string `json:"serviceEndpoint"`
21
21
+
}
22
22
+
23
23
+
func didDoc(c echo.Context) error {
24
24
+
doc := DidDocument{
25
25
+
context: []string{"https://www.w3.org/ns/did/v1"},
26
26
+
id: `did:web:` + NgrokHostname,
27
27
+
services: []DidService{
28
28
+
DidService{
29
29
+
id: "#bsky_fg",
30
30
+
serviceType: "BskyFeedGenerator",
31
31
+
serviceEndpoint: `https://` + NgrokHostname,
32
32
+
},
33
33
+
},
34
34
+
}
35
35
+
return c.JSON(http.StatusOK, doc)
36
36
+
}
+1
cmd/feedweb/main.go
···
52
52
e := echo.New()
53
53
e.Use(middleware.Logger())
54
54
e.Use(middleware.Recover())
55
55
+
e.GET("/.well-known/did.json", didDoc)
55
56
e.GET("/xrpc/app.bsky.feed.getFeedSkeleton", getFeedSkeleton)
56
57
e.Logger.Fatal(e.Start(":5000"))
57
58
}