Fix typos (#186)

Disclaimer: I have no idea what I'm looking at.

Some tests fail, but I believe they have nothing to do with my changes
(fingers crossed). `make certs` doesn't work, I don't have `minica`
installed and don't want to litter my system with even more stuff. It's
bad enough that I got a shitload of Go dependencies downloaded when
running `make test`.

Co-authored-by: Lysander Trischler <twtxt@lyse.isobeef.org>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/186
Reviewed-by: James Mills <james@mills.io>
Co-authored-by: lyse <lyse@noreply@mills.io>
Co-committed-by: lyse <lyse@noreply@mills.io>
This commit is contained in:
lyse 2023-01-27 23:24:19 +00:00 committed by James Mills
parent f3b7f14e5e
commit c67f5c69b2
6 changed files with 13 additions and 13 deletions

View File

@ -27,10 +27,10 @@ type Addr interface {
Hash() string
// Formatted returns a formatted user used in the Salty Message Format
// <timestamp\t(<user>) <message>\n
// <timestamp>\t(<user>) <message>\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
}

View File

@ -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"),
)

View File

@ -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)
}
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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) {