Skip to content

Commit

Permalink
Merge pull request #41 from aidantwoods/remove-force-unwrap-footer
Browse files Browse the repository at this point in the history
No longer force unwrap footer result
  • Loading branch information
aidantwoods authored Jun 17, 2023
2 parents d3e92cb + bd16e3e commit be67f28
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module aidanwoods.dev/go-paseto
go 1.18

require (
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.7.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7 h1:bVUDSxup1h+a2DenqxeTWRschTdSMmo1Cy5/LxnzCtc=
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7/go.mod h1:yridkWghM7AXSFA6wzx0IbsurIm1Lhuro3rYef8FBHM=
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54 h1:D4xKM5zeP8OHMy8il4nwMssVBr9k3fM3iKeGH0lNIgw=
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54/go.mod h1:yridkWghM7AXSFA6wzx0IbsurIm1Lhuro3rYef8FBHM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (p Parser) UnsafeParseFooter(protocol Protocol, tainted string) ([]byte, er
return t.Chain[[]byte](
newMessage(protocol, tainted)).
Map(message.unsafeFooter).
UnwrappedResults()
ResultsMappingEmpty()
}

// SetRules will overwrite any currently set rules with those specified.
Expand Down
17 changes: 17 additions & 0 deletions parser_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package paseto_test

import (
"testing"

"aidanwoods.dev/go-paseto"
"github.com/stretchr/testify/require"
)

func TestUnwrapEmptyFooter(t *testing.T) {
token := "v4.local.aGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQ."

parser := paseto.NewParser()
footer, err := parser.UnsafeParseFooter(paseto.V4Local, token)
require.NoError(t, err)
require.Empty(t, footer)
}

0 comments on commit be67f28

Please sign in to comment.