An atproto PDS written in Go

Implement the age assurance endpoint #6

merged opened by willdot.net targeting main from willdot.net/cocoon: age-assurance

Controversial I know.

Labels

None yet.

Participants 2
AT URI
at://did:plc:dadhhalkfcq3gucaq25hjqon/sh.tangled.repo.pull/3mcqz6sdmin22
+27 -1
Diff #0
+26
server/handle_age_assurance.go
··· 1 + package server 2 + 3 + import ( 4 + "time" 5 + 6 + "github.com/bluesky-social/indigo/util" 7 + "github.com/haileyok/cocoon/models" 8 + "github.com/labstack/echo/v4" 9 + ) 10 + 11 + func (s *Server) handleAgeAssurance(e echo.Context) error { 12 + repo := e.Get("repo").(*models.RepoActor) 13 + 14 + resp := map[string]any{ 15 + "state": map[string]any{ 16 + "status": "assured", 17 + "access": "full", 18 + "lastInitiatedAt": time.Now().Format(util.ISO8601), 19 + }, 20 + "metadata": map[string]any{ 21 + "accountCreatedAt": repo.CreatedAt.Format(util.ISO8601), 22 + }, 23 + } 24 + 25 + return e.JSON(200, resp) 26 + }
+1 -1
server/server.go
··· 532 532 s.echo.GET("/xrpc/app.bsky.actor.getPreferences", s.handleActorGetPreferences, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware) 533 533 s.echo.POST("/xrpc/app.bsky.actor.putPreferences", s.handleActorPutPreferences, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware) 534 534 s.echo.GET("/xrpc/app.bsky.feed.getFeed", s.handleProxyBskyFeedGetFeed, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware) 535 - 535 + s.echo.GET("/xrpc/app.bsky.ageassurance.getState", s.handleAgeAssurance, s.handleLegacySessionMiddleware, s.handleOauthSessionMiddleware) 536 536 // admin routes 537 537 s.echo.POST("/xrpc/com.atproto.server.createInviteCode", s.handleCreateInviteCode, s.handleAdminMiddleware) 538 538 s.echo.POST("/xrpc/com.atproto.server.createInviteCodes", s.handleCreateInviteCodes, s.handleAdminMiddleware)

History

1 round 1 comment
sign up or login to add to the discussion
willdot.net submitted #0
1 commit
expand
add age assurance endpoint
expand 1 comment

ya lets do it

pull request successfully merged