Files
cloud-services/services/ota_update_go/handlers/manufacture_dll_certs.go

31 lines
1.1 KiB
Go

package handlers
import (
"net/http"
v "github.com/fiskerinc/cloud-services/pkg/hashvault"
"github.com/fiskerinc/cloud-services/pkg/utils"
"github.com/fiskerinc/cloud-services/pkg/loggerdataresp"
)
// HandleGetDLLManufactureCerts godoc
// @Summary Generates public and private certificates for security dll.
// @Description Generates public and private certificates for security dll to access manufacture/secaccess API
// @Accept json
// @Produce json
// @Param Authorization header string false "Bearer <ID token>"
// @Param Api-Key header string false "<API token>"
// @Success 200 {object} common.Certificate "Created public and private pems"
// @Failure 400 {object} common.JSONError "Bad request"
// @Failure 401 {object} common.JSONError "Unauthorized"
// @Failure 503 {object} common.JSONError "Service unavailable"
// @Router /manufacture-certs [post]
func HandleGetDLLManufactureCerts(w http.ResponseWriter, r *http.Request) {
cert, err := v.GetVaultClient().CreatePKICertificate("ALL")
if loggerdataresp.BadDataErrorResp(w, err, http.StatusServiceUnavailable) {
return
}
utils.RespJSON(w, http.StatusOK, cert)
}