diff --git a/checkin/transport_http.go b/checkin/transport_http.go index b5f1777a..63592639 100644 --- a/checkin/transport_http.go +++ b/checkin/transport_http.go @@ -30,10 +30,6 @@ type errorer interface { error() error } -type errorWrapper struct { - Error string `json:"error"` -} - func decodeRequest(ctx context.Context, r *http.Request) (interface{}, error) { var req checkinRequest err := plist.NewDecoder(io.LimitReader(r.Body, 10000)).Decode(&req) diff --git a/command/event.go b/command/event.go index b2467269..22741cf0 100644 --- a/command/event.go +++ b/command/event.go @@ -257,7 +257,3 @@ func UnmarshalEvent(data []byte, e *Event) error { func stringPtr(s string) *string { return &s } - -func boolPtr(b bool) *bool { - return &b -} diff --git a/command/transport_http.go b/command/transport_http.go index 10fb9604..41d0a36b 100644 --- a/command/transport_http.go +++ b/command/transport_http.go @@ -3,7 +3,6 @@ package command import ( "context" "encoding/json" - "errors" "io" "net/http" @@ -46,27 +45,6 @@ func EncodeError(ctx context.Context, err error, w http.ResponseWriter) { }) } -func codeFromErr(err error) int { - switch err { - case errEmptyRequest: - return http.StatusBadRequest - default: - return http.StatusInternalServerError - } -} - -func errorDecoder(r *http.Response) error { - var w errorWrapper - if err := json.NewDecoder(r.Body).Decode(&w); err != nil { - return err - } - return errors.New(w.Error) -} - -type errorWrapper struct { - Error string `json:"error"` -} - func decodeRequest(ctx context.Context, r *http.Request) (interface{}, error) { var req newCommandRequest err := json.NewDecoder(io.LimitReader(r.Body, 10000)).Decode(&req) diff --git a/config/db.go b/config/db.go index f2e12e49..21d4501b 100644 --- a/config/db.go +++ b/config/db.go @@ -122,13 +122,6 @@ func (db *DB) PushTopic() (string, error) { return topic, errors.Wrap(err, "get topic from push certificate") } -func isNotFound(err error) bool { - if _, ok := err.(*notFound); ok { - return true - } - return false -} - type notFound struct { ResourceType string Message string diff --git a/connect/endpoint.go b/connect/endpoint.go index 5c987e96..acccaeb6 100644 --- a/connect/endpoint.go +++ b/connect/endpoint.go @@ -2,7 +2,6 @@ package connect import ( "context" - "errors" "github.com/go-kit/kit/endpoint" "github.com/micromdm/mdm" @@ -19,9 +18,6 @@ type mdmConnectResponse struct { func (r mdmConnectResponse) error() error { return r.Err } -// errInvalidMessageType is an invalid checking command. -var errInvalidMessageType = errors.New("invalid message type") - type Endpoints struct { ConnectEndpoint endpoint.Endpoint } diff --git a/connect/transport_http.go b/connect/transport_http.go index 29820405..db56ab60 100644 --- a/connect/transport_http.go +++ b/connect/transport_http.go @@ -29,10 +29,6 @@ type errorer interface { error() error } -type errorWrapper struct { - Error string `json:"error"` -} - func decodeRequest(ctx context.Context, r *http.Request) (interface{}, error) { var req mdmConnectRequest err := plist.NewDecoder(r.Body).Decode(&req) diff --git a/enroll/endpoint.go b/enroll/endpoint.go index 677c40d2..4a836038 100644 --- a/enroll/endpoint.go +++ b/enroll/endpoint.go @@ -55,11 +55,6 @@ type mdmOTAPhase2Phase3Request struct { p7 *pkcs7.PKCS7 } -type mdmOTAEnrollResponse struct { - Payload - Err error `plist:"error,omitempty"` -} - func MakeServerEndpoints(s Service, scepDepot *boltdepot.Depot) Endpoints { return Endpoints{ GetEnrollEndpoint: MakeGetEnrollEndpoint(s), diff --git a/push/endpoint.go b/push/endpoint.go index 61dc1612..bbb13171 100644 --- a/push/endpoint.go +++ b/push/endpoint.go @@ -2,13 +2,10 @@ package push import ( "context" - "errors" "github.com/go-kit/kit/endpoint" ) -var errEmptyRequest = errors.New("request must contain UDID of the device") - type Endpoints struct { PushEndpoint endpoint.Endpoint } diff --git a/push/transport_http.go b/push/transport_http.go index f85c9492..6de6dd39 100644 --- a/push/transport_http.go +++ b/push/transport_http.go @@ -46,27 +46,6 @@ func EncodeError(ctx context.Context, err error, w http.ResponseWriter) { }) } -func codeFromErr(err error) int { - switch err { - case errEmptyRequest: - return http.StatusBadRequest - default: - return http.StatusInternalServerError - } -} - -func errorDecoder(r *http.Response) error { - var w errorWrapper - if err := json.NewDecoder(r.Body).Decode(&w); err != nil { - return err - } - return errors.New(w.Error) -} - -type errorWrapper struct { - Error string `json:"error"` -} - func decodeRequest(ctx context.Context, r *http.Request) (interface{}, error) { var errBadRoute = errors.New("bad route") var req pushRequest diff --git a/serve.go b/serve.go index f25c7117..34069388 100644 --- a/serve.go +++ b/serve.go @@ -882,12 +882,6 @@ func mdmAuthSignMessageMiddleware(db *boltdepot.Depot, next http.Handler) http.H } } -func basicAuth(password string) string { - const authUsername = "micromdm" - auth := authUsername + ":" + password - return base64.StdEncoding.EncodeToString([]byte(auth)) -} - func apiAuthMiddleware(token string, next http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { _, password, ok := r.BasicAuth() @@ -897,7 +891,6 @@ func apiAuthMiddleware(token string, next http.Handler) http.HandlerFunc { return } next.ServeHTTP(w, r) - } } diff --git a/user/db.go b/user/db.go index 620e6e97..5c5b8302 100644 --- a/user/db.go +++ b/user/db.go @@ -139,10 +139,3 @@ type notFound struct { func (e *notFound) Error() string { return fmt.Sprintf("not found: %s %s", e.ResourceType, e.Message) } - -func isNotFound(err error) bool { - if _, ok := err.(*notFound); ok { - return true - } - return false -}