diff --git a/api/handler.go b/api/handler.go index a048d88..07a69a5 100644 --- a/api/handler.go +++ b/api/handler.go @@ -17,7 +17,7 @@ import ( type RegisterInput struct { CertName string `json:"cert_name"` - CertFileBase64 string `json:"cert_file"` + CertFile string `json:"cert_file"` PasswordEncrypted string `json:"password_encrypted"` } @@ -72,7 +72,7 @@ func (h *Handler) RegisterCert(w http.ResponseWriter, r *http.Request) { return } - if input.CertName == "" || input.CertFileBase64 == "" || input.PasswordEncrypted == "" { + if input.CertName == "" || input.CertFile == "" || input.PasswordEncrypted == "" { w.Header().Set("Content-Type", "application/json") w.Write([]byte(`{"success":false,"error":"missing_fields"}`)) return @@ -94,7 +94,7 @@ func (h *Handler) RegisterCert(w http.ResponseWriter, r *http.Request) { plainPass := string(plainPassBytes) - validation := cert.ValidateP12(input.CertFileBase64, plainPass) + validation := cert.ValidateP12(input.CertFile, plainPass) if !validation.Valid { resp, _ := json.Marshal(map[string]interface{}{ "success": false, @@ -106,7 +106,7 @@ func (h *Handler) RegisterCert(w http.ResponseWriter, r *http.Request) { return } - tempPath, err := h.cert.StoreFromBase64(input.CertName, input.CertFileBase64) + tempPath, err := h.cert.StoreFromBase64(input.CertName, input.CertFile) if err != nil { h.cert.DeleteTemp(tempPath) w.Header().Set("Content-Type", "application/json")