An atproto PDS written in Go
at v0.5.1 881 B view raw
1package server 2 3import ( 4 "github.com/haileyok/cocoon/models" 5 "github.com/labstack/echo/v4" 6) 7 8type ComAtprotoServerGetSessionResponse struct { 9 Handle string `json:"handle"` 10 Did string `json:"did"` 11 Email string `json:"email"` 12 EmailConfirmed bool `json:"emailConfirmed"` 13 EmailAuthFactor bool `json:"emailAuthFactor"` 14 Active bool `json:"active"` 15 Status *string `json:"status,omitempty"` 16} 17 18func (s *Server) handleGetSession(e echo.Context) error { 19 repo := e.Get("repo").(*models.RepoActor) 20 21 return e.JSON(200, ComAtprotoServerGetSessionResponse{ 22 Handle: repo.Handle, 23 Did: repo.Repo.Did, 24 Email: repo.Email, 25 EmailConfirmed: repo.EmailConfirmedAt != nil, 26 EmailAuthFactor: false, // TODO: todo todo 27 Active: repo.Active(), 28 Status: repo.Status(), 29 }) 30}