mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-19 00:34:16 +00:00
add atproto-did endpoint
This commit is contained in:
+13
-1
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user