MCPcopy Index your code
hub / github.com/coder/coder / workspaceProxyCryptoKeys

Method workspaceProxyCryptoKeys

enterprise/coderd/workspaceproxy.go:756–783  ·  view source on GitHub ↗

workspaceProxyCryptoKeys is used to fetch signing keys for the workspace proxy. This is called periodically by the proxy in the background (every 10m per replica) to ensure that the proxy has the latest signing keys. @Summary Get workspace proxy crypto keys @ID get-workspace-proxy-crypto-keys @Sec

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

754// @Router /api/v2/workspaceproxies/me/crypto-keys [get]
755// @x-apidocgen {"skip": true}
756func (api *API) workspaceProxyCryptoKeys(rw http.ResponseWriter, r *http.Request) {
757 ctx := r.Context()
758
759 feature := database.CryptoKeyFeature(r.URL.Query().Get("feature"))
760 if feature == "" {
761 httpapi.Write(r.Context(), rw, http.StatusBadRequest, codersdk.Response{
762 Message: "Missing feature query parameter.",
763 })
764 return
765 }
766
767 if !slices.Contains(whitelistedCryptoKeyFeatures, feature) {
768 httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
769 Message: fmt.Sprintf("Invalid feature: %q", feature),
770 })
771 return
772 }
773
774 keys, err := api.Database.GetCryptoKeysByFeature(ctx, feature)
775 if err != nil {
776 httpapi.InternalServerError(rw, err)
777 return
778 }
779
780 httpapi.Write(ctx, rw, http.StatusOK, wsproxysdk.CryptoKeysResponse{
781 CryptoKeys: db2sdk.CryptoKeys(keys),
782 })
783}
784
785// @Summary Deregister workspace proxy
786// @ID deregister-workspace-proxy

Callers

nothing calls this directly

Calls 8

CryptoKeyFeatureTypeAlias · 0.92
WriteFunction · 0.92
InternalServerErrorFunction · 0.92
CryptoKeysFunction · 0.92
ContextMethod · 0.65
GetMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected