Skip to content

Commit be67f28

Browse files
authored
Merge pull request #41 from aidantwoods/remove-force-unwrap-footer
No longer force unwrap footer result
2 parents d3e92cb + bd16e3e commit be67f28

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module aidanwoods.dev/go-paseto
33
go 1.18
44

55
require (
6-
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7
6+
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54
77
github.com/stretchr/testify v1.7.0
88
golang.org/x/crypto v0.7.0
99
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7 h1:bVUDSxup1h+a2DenqxeTWRschTdSMmo1Cy5/LxnzCtc=
2-
aidanwoods.dev/go-result v0.0.0-20230310133209-26c34aabd0c7/go.mod h1:yridkWghM7AXSFA6wzx0IbsurIm1Lhuro3rYef8FBHM=
1+
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54 h1:D4xKM5zeP8OHMy8il4nwMssVBr9k3fM3iKeGH0lNIgw=
2+
aidanwoods.dev/go-result v0.0.0-20230617093509-2c57d7732f54/go.mod h1:yridkWghM7AXSFA6wzx0IbsurIm1Lhuro3rYef8FBHM=
33
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (p Parser) UnsafeParseFooter(protocol Protocol, tainted string) ([]byte, er
100100
return t.Chain[[]byte](
101101
newMessage(protocol, tainted)).
102102
Map(message.unsafeFooter).
103-
UnwrappedResults()
103+
ResultsMappingEmpty()
104104
}
105105

106106
// SetRules will overwrite any currently set rules with those specified.

parser_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package paseto_test
2+
3+
import (
4+
"testing"
5+
6+
"aidanwoods.dev/go-paseto"
7+
"github.com/stretchr/testify/require"
8+
)
9+
10+
func TestUnwrapEmptyFooter(t *testing.T) {
11+
token := "v4.local.aGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQgaGVsbG8gd29ybGQ."
12+
13+
parser := paseto.NewParser()
14+
footer, err := parser.UnsafeParseFooter(paseto.V4Local, token)
15+
require.NoError(t, err)
16+
require.Empty(t, footer)
17+
}

0 commit comments

Comments
 (0)