this repo has no description

feat: add .well-known/did.json

+37
+36
cmd/feedweb/did.go
··· 1 + package main 2 + 3 + import ( 4 + "net/http" 5 + 6 + "github.com/labstack/echo/v4" 7 + ) 8 + 9 + const NgrokHostname = "routinely-right-barnacle.ngrok-free.app" 10 + 11 + type DidDocument struct { 12 + context []string `json:"@context"` 13 + id string `json:"id"` 14 + services []DidService `json:"service"` 15 + } 16 + 17 + type DidService struct { 18 + id string `json:"id"` 19 + serviceType string `json:"type"` 20 + serviceEndpoint string `json:"serviceEndpoint"` 21 + } 22 + 23 + func didDoc(c echo.Context) error { 24 + doc := DidDocument{ 25 + context: []string{"https://www.w3.org/ns/did/v1"}, 26 + id: `did:web:` + NgrokHostname, 27 + services: []DidService{ 28 + DidService{ 29 + id: "#bsky_fg", 30 + serviceType: "BskyFeedGenerator", 31 + serviceEndpoint: `https://` + NgrokHostname, 32 + }, 33 + }, 34 + } 35 + return c.JSON(http.StatusOK, doc) 36 + }
+1
cmd/feedweb/main.go
··· 52 52 e := echo.New() 53 53 e.Use(middleware.Logger()) 54 54 e.Use(middleware.Recover()) 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 }