diff --git a/addr.go b/addr.go index 43ac2a9..20dd149 100644 --- a/addr.go +++ b/addr.go @@ -27,10 +27,10 @@ type Addr interface { Hash() string // Formatted returns a formatted user used in the Salty Message Format - // ) \n + // \t() \n Formatted() string - // Key returns the Publib Kcy of this User (Salty Addr) as discovered + // Key returns the Public Key of this User (Salty Addr) as discovered Key() *keys.EdX25519PublicKey // Endpoint returns the discovered Endpoint @@ -56,7 +56,7 @@ type Addr interface { // avatar service found, then a default avatar is used for peers. Avatar() string - // WithEndpoint returns a clonse of this address with a different endpoint + // WithEndpoint returns a clone of this address with a different endpoint // which is mostly useful for sending messages to ourselves or an outbox WithEndpoint(endpoint *url.URL) Addr } diff --git a/client_e2e_test.go b/client_e2e_test.go index 42dd776..9168f1d 100644 --- a/client_e2e_test.go +++ b/client_e2e_test.go @@ -33,7 +33,7 @@ var ( func TestMain(m *testing.M) { if !internal.FileExists(tlsKey) || !internal.FileExists(tlsCrt) { - fmt.Printf("error: certs not found, please run: ;make certs\n") + fmt.Printf("error: certs not found, please run: make certs\n") os.Exit(1) } @@ -59,7 +59,7 @@ func TestMain(m *testing.M) { internal.WithBaseURL(serverBaseURL), internal.WithPrimaryDomain(serverPrimaryDomain), - // Oeprator + // Operator internal.WithAdminUser("admin@localhost"), internal.WithSupportEmail("support@localhost"), ) diff --git a/internal/api.go b/internal/api.go index 1daf304..d430ce0 100644 --- a/internal/api.go +++ b/internal/api.go @@ -164,7 +164,7 @@ func (a *API) BlobEndpoint() httprouter.Handle { claims := authreq.ClaimsFromRequest(r) if claims == nil { log.Warn("no claims") - http.Error(w, "Unauthorised", http.StatusUnauthorized) + http.Error(w, "Unauthorized", http.StatusUnauthorized) return } signer := claims.Issuer @@ -220,6 +220,7 @@ func (a *API) BlobEndpoint() httprouter.Handle { http.Error(w, "Blob Created", http.StatusCreated) default: + w.Header().Add("Allow", "GET, HEAD, PUT, DELETE") http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed) } } diff --git a/internal/authreq/authreq.go b/internal/authreq/authreq.go index 7773570..999ae42 100644 --- a/internal/authreq/authreq.go +++ b/internal/authreq/authreq.go @@ -77,7 +77,6 @@ func VerifyMiddleware(next httprouter.Handle) httprouter.Handle { usedIDs := cache.New(signatureLifetime, 2*signatureLifetime) return func(rw http.ResponseWriter, req *http.Request, p httprouter.Params) { - log.Debugf("XXX") auth := req.Header.Get(authorizationHeader) if auth == "" { log.Warn("no authorization found") @@ -93,7 +92,7 @@ func VerifyMiddleware(next httprouter.Handle) httprouter.Handle { mw := io.MultiWriter(hash, buf) _, err := io.Copy(mw, req.Body) if err != nil { - log.WithError(err).Error("error hasning request body") + log.WithError(err).Error("error hashing request body") rw.WriteHeader(http.StatusBadRequest) return } @@ -124,7 +123,7 @@ func VerifyMiddleware(next httprouter.Handle) httprouter.Handle { claims, ok := token.Claims.(*jwt.RegisteredClaims) if !ok { - log.Warn("no claims found!") + log.Warn("no claims found") rw.WriteHeader(http.StatusUnprocessableEntity) return } diff --git a/types.go b/types.go index 54df144..206b796 100644 --- a/types.go +++ b/types.go @@ -81,7 +81,7 @@ func NewAvatarRequest(r io.Reader) (req AvatarRequest, signer string, err error) } // Blob defines the type, filename and whether or not a blob is publicly accessible or not. -// A Blob also holds zero r more properties as a map of key/value pairs of string interpreted +// A Blob also holds zero or more properties as a map of key/value pairs of string interpreted // by the client. type Blob struct { r io.ReadSeekCloser @@ -121,7 +121,7 @@ type BlobRequest struct { // NewBlobRequest reads the signed request body from a client, verifies its signature // and returns the resulting `BlobRequest` and key used to sign the request on success -// otherwise an empty object and en error on failure. +// otherwise an empty object and an error on failure. func NewBlobRequest(r io.Reader) (req BlobRequest, signer string, err error) { body, err := io.ReadAll(r) if err != nil { @@ -138,7 +138,7 @@ func NewBlobRequest(r io.Reader) (req BlobRequest, signer string, err error) { // NewRawRequest reads the signed request body from a client, verifies its signature // and returns the resulting `[]byte` slice and key used to sign the request on success -// otherwise an empty object and en error on failure. +// otherwise an empty object and an error on failure. func NewRawRequest(r io.Reader) (out []byte, signer string, err error) { body, err := io.ReadAll(r) if err != nil { diff --git a/utils.go b/utils.go index b000bcf..382812a 100644 --- a/utils.go +++ b/utils.go @@ -41,7 +41,7 @@ func MustGenerateULID() string { return ulid } -// Request is a generic request handling function for making artbitrary HTPT +// Request is a generic request handling function for making artbitrary HTTP // requests to Salty endpoints for looking up Salty Addresses, Configs and // publishing encrypted messages. func Request(method, uri string, headers http.Header, body io.Reader) (*http.Response, error) {