diff --git a/v1loc.go b/v1loc.go index 0e3551e..ea01e39 100644 --- a/v1loc.go +++ b/v1loc.go @@ -13,10 +13,10 @@ import ( ) const ( + v1LocHeader = "v1.local." v1LocNonceSize = 32 v1LocNonceHalf = v1LocNonceSize / 2 v1LocMacSize = 48 // const for crypty.SHA384.Size() - v1LocHeader = "v1.local." ) func V1Encrypt(key []byte, payload, footer any, randBytes []byte) (string, error) { @@ -96,7 +96,7 @@ func V1Decrypt(token string, key []byte, payload, footer any) error { } if !hmac.Equal(h.Sum(nil), mac) { - return fmt.Errorf("token signature: %w", ErrInvalidTokenAuth) + return ErrInvalidTokenAuth } block, err := aes.NewCipher(encKey) diff --git a/v1loc_test.go b/v1loc_test.go index 7c284ef..25f9398 100644 --- a/v1loc_test.go +++ b/v1loc_test.go @@ -21,9 +21,7 @@ func TestV1Loc_Encrypt(t *testing.T) { nonce := must(hex.DecodeString(tc.Nonce)) token, err := V1Encrypt(key, payload, footer, nonce) - if err != nil { - t.Fatal(err) - } + mustOk(t, err) mustEqual(t, token, tc.Token) }) }