Skip to content

Commit e01b509

Browse files
committed
bump gin-pow to v0.5.0
1 parent 2749a3c commit e01b509

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

generateProblem_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func Test_server_GenerateProblem(t *testing.T) {
2929
Secret: "secret",
3030
NonceChecksumContextKey: "checksum",
3131
ExtractData: func(c *gin.Context) (string, error) { return "", nil },
32-
NonceGenerator: func(i int) (string, error) { return "test1.123", nil },
32+
NonceGenerator: func(i int) ([]byte, error) { return []byte("test1.123"), nil },
3333
})
3434

3535
if err != nil {
@@ -82,7 +82,7 @@ func Test_server_GenerateProblem(t *testing.T) {
8282
m, err := ginpow.New(&ginpow.Middleware{
8383
NonceChecksumContextKey: "checksum",
8484
ExtractData: func(c *gin.Context) (string, error) { return "", nil },
85-
NonceGenerator: func(i int) (string, error) { return "test1.123", nil },
85+
NonceGenerator: func(i int) ([]byte, error) { return []byte("test1.123"), nil },
8686
})
8787

8888
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/fatih/structs v1.1.0
99
github.com/gin-gonic/gin v1.6.3
1010
github.com/go-redis/redis/v8 v8.2.3
11-
github.com/jeongy-cho/gin-pow v0.4.1
11+
github.com/jeongy-cho/gin-pow v0.5.0
1212
github.com/lestrrat/go-jwx v0.0.0-20180221005942-b7d4802280ae
1313
github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8 // indirect
1414
github.com/matoous/go-nanoid v1.4.1

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,14 @@ github.com/jeongy-cho/gin-pow v0.4.0 h1:MU3o32qCbvUlRymKk/iiARYRNEzVi796aPR7APrv
7171
github.com/jeongy-cho/gin-pow v0.4.0/go.mod h1:6+lYmwfWI8e2DuIkKZ+Sse3rWTGCFn01PTIwuMOyTmI=
7272
github.com/jeongy-cho/gin-pow v0.4.1 h1:Vr47ysnCFfeqNmOzY2CfptQM8D31GSHTOBkt0bqv6LM=
7373
github.com/jeongy-cho/gin-pow v0.4.1/go.mod h1:6+lYmwfWI8e2DuIkKZ+Sse3rWTGCFn01PTIwuMOyTmI=
74+
github.com/jeongy-cho/gin-pow v0.5.0 h1:HGAUAH5GF9jK1YxInU+0PkItfnYusq2Pt9zdEC6o8qc=
75+
github.com/jeongy-cho/gin-pow v0.5.0/go.mod h1:qY9MVa+Fi1BC5y42N/Ol8esYvpg8mblZCy87+ukMNxg=
7476
github.com/jeongy-cho/go-pow v1.2.1 h1:z4vJ5M+pjN/tb7b+IeZ4QeXJ7AQDps1mKJmLIHvslpg=
7577
github.com/jeongy-cho/go-pow v1.2.1/go.mod h1:LK4l4W/AvtVIgbOGGyc7t3NiGhsczT9AgEvhKQqXDRQ=
78+
github.com/jeongy-cho/go-pow v1.3.0 h1:JHABXDWobK/e558kWo1t3ULVbuKXfsYE8+n6IqzA8Zg=
79+
github.com/jeongy-cho/go-pow v1.3.0/go.mod h1:LK4l4W/AvtVIgbOGGyc7t3NiGhsczT9AgEvhKQqXDRQ=
80+
github.com/jeongy-cho/go-pow/v2 v2.0.1 h1:tmvh5oWgVUQDOgLRaeoBTp4uXjrEkZrbj9mcJaYVxRU=
81+
github.com/jeongy-cho/go-pow/v2 v2.0.1/go.mod h1:q1MZX95Jwp9tGo7Gwe3SFpSoTJKzwqZuMD0kVfCc/X8=
7682
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
7783
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
7884
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=

pogifyApi.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,17 @@ func Server(rr *gin.RouterGroup) {
152152
rr.POST("/auth/twitch", s.twitchAuth)
153153
}
154154

155-
func generateSessionCode(_ int) (string, error) {
155+
func generateSessionCode(_ int) ([]byte, error) {
156156
// testing flag for predictable keys
157157
if _testing {
158-
return "test1.123", nil
158+
return []byte("test1.123"), nil
159159
}
160160

161161
nonce, err := gonanoid.Generate("abcdefghijklmnopqrstuwxyz0123456789-", 5)
162162
if err != nil {
163-
return "", err
163+
return []byte(""), err
164164
}
165-
return fmt.Sprintf("%v.%v", nonce, time.Now().Unix()), nil
165+
return []byte(fmt.Sprintf("%v.%v", nonce, time.Now().Unix())), nil
166166
}
167167

168168
// Time is a JSON un/marshallable type of time.Time

pogifyApi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func Test_generateSessionCode(t *testing.T) {
218218
panic(err)
219219
}
220220

221-
split := strings.Split(nonce, ".")
221+
split := strings.Split(string(nonce), ".")
222222

223223
if expect := 5; len(split[0]) != expect {
224224
t.Errorf("different session id length: %v, expected %v", len(split[0]), expect)

0 commit comments

Comments
 (0)