add atproto-did endpoint

This commit is contained in:
Evan Jarrett
2025-10-14 23:55:31 -05:00
parent 4c930e8ae5
commit bd7d8c62b0
+13 -1
View File
@@ -68,8 +68,9 @@ func (h *XRPCHandler) RegisterHandlers(mux *http.ServeMux) {
mux.HandleFunc("/xrpc/com.atproto.repo.uploadBlob", corsMiddleware(h.HandleUploadBlob))
mux.HandleFunc("/xrpc/com.atproto.sync.getBlob", corsMiddleware(h.HandleGetBlob))
// DID document
// DID document and handle resolution
mux.HandleFunc("/.well-known/did.json", corsMiddleware(h.HandleDIDDocument))
mux.HandleFunc("/.well-known/atproto-did", corsMiddleware(h.HandleAtprotoDID))
}
// HandleHealth returns health check information
@@ -364,3 +365,14 @@ func (h *XRPCHandler) HandleDIDDocument(w http.ResponseWriter, r *http.Request)
w.Header().Set("Content-Type", "application/did+json")
json.NewEncoder(w).Encode(doc)
}
// HandleAtprotoDID returns the DID for handle resolution
func (h *XRPCHandler) HandleAtprotoDID(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
w.Header().Set("Content-Type", "text/plain")
fmt.Fprint(w, h.pds.DID())
}