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)
| 754 | // @Router /api/v2/workspaceproxies/me/crypto-keys [get] |
| 755 | // @x-apidocgen {"skip": true} |
| 756 | func (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 |
nothing calls this directly
no test coverage detected