Skip to content

Commit 2bbf853

Browse files
committed
minor
1 parent 374916c commit 2bbf853

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
go_version: [1.24.x]
17+
go_version: [1.25.x]
1818
steps:
1919

2020
- name: Set up Go 1.x

_benchmarks/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module benchmarks
22

3-
go 1.24
3+
go 1.25
44

55
replace github.com/kataras/jwt => ../
66

claims_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -171,33 +171,33 @@ func TestMerge(t *testing.T) {
171171

172172
tests := []struct {
173173
name string
174-
claims interface{}
175-
other interface{}
176-
expected map[string]interface{}
174+
claims any
175+
other any
176+
expected map[string]any
177177
}{
178178
{
179179
name: "merge with empty object",
180-
claims: map[string]interface{}{"foo": "bar"},
181-
other: map[string]interface{}{},
182-
expected: map[string]interface{}{"foo": "bar"},
180+
claims: map[string]any{"foo": "bar"},
181+
other: map[string]any{},
182+
expected: map[string]any{"foo": "bar"},
183183
},
184184
{
185185
name: "merge two maps",
186-
claims: map[string]interface{}{"foo": "bar"},
187-
other: map[string]interface{}{"baz": "qux"},
188-
expected: map[string]interface{}{"foo": "bar", "baz": "qux"},
186+
claims: map[string]any{"foo": "bar"},
187+
other: map[string]any{"baz": "qux"},
188+
expected: map[string]any{"foo": "bar", "baz": "qux"},
189189
},
190190
{
191191
name: "merge with Claims struct",
192-
claims: map[string]interface{}{
192+
claims: map[string]any{
193193
"custom": "value",
194194
},
195195
other: Claims{
196196
Issuer: "test-issuer",
197197
IssuedAt: now,
198198
Expiry: expiry,
199199
},
200-
expected: map[string]interface{}{
200+
expected: map[string]any{
201201
"custom": "value",
202202
"iss": "test-issuer",
203203
"iat": float64(now), // JSON numbers are decoded as float64
@@ -206,9 +206,9 @@ func TestMerge(t *testing.T) {
206206
},
207207
{
208208
name: "merge with nil",
209-
claims: map[string]interface{}{"foo": "bar"},
209+
claims: map[string]any{"foo": "bar"},
210210
other: nil,
211-
expected: map[string]interface{}{"foo": "bar"},
211+
expected: map[string]any{"foo": "bar"},
212212
},
213213
}
214214

@@ -219,7 +219,7 @@ func TestMerge(t *testing.T) {
219219
t.Fatalf("Failed to merge: %v", err)
220220
}
221221

222-
var got map[string]interface{}
222+
var got map[string]any
223223
if err := json.Unmarshal(result, &got); err != nil {
224224
t.Fatalf("Failed to unmarshal result: %v", err)
225225
}
@@ -237,33 +237,33 @@ func TestMergeAndSign(t *testing.T) {
237237

238238
tests := []struct {
239239
name string
240-
claims interface{}
241-
other interface{}
242-
expected map[string]interface{}
240+
claims any
241+
other any
242+
expected map[string]any
243243
}{
244244
{
245245
name: "merge and sign with empty object",
246-
claims: map[string]interface{}{"foo": "bar"},
247-
other: map[string]interface{}{},
248-
expected: map[string]interface{}{"foo": "bar"},
246+
claims: map[string]any{"foo": "bar"},
247+
other: map[string]any{},
248+
expected: map[string]any{"foo": "bar"},
249249
},
250250
{
251251
name: "merge and sign two maps",
252-
claims: map[string]interface{}{"foo": "bar"},
253-
other: map[string]interface{}{"baz": "qux"},
254-
expected: map[string]interface{}{"foo": "bar", "baz": "qux"},
252+
claims: map[string]any{"foo": "bar"},
253+
other: map[string]any{"baz": "qux"},
254+
expected: map[string]any{"foo": "bar", "baz": "qux"},
255255
},
256256
{
257257
name: "merge and sign with Claims struct",
258-
claims: map[string]interface{}{
258+
claims: map[string]any{
259259
"custom": "value",
260260
},
261261
other: Claims{
262262
Issuer: "test-issuer",
263263
IssuedAt: now,
264264
Expiry: expiry,
265265
},
266-
expected: map[string]interface{}{
266+
expected: map[string]any{
267267
"custom": "value",
268268
"iss": "test-issuer",
269269
"iat": fmt.Sprintf("%d", now),
@@ -287,7 +287,7 @@ func TestMergeAndSign(t *testing.T) {
287287

288288
t.Logf("Generated token: %s", string(token))
289289

290-
var verifiedClaims map[string]interface{}
290+
var verifiedClaims map[string]any
291291
verifiedToken, err := Verify(HS256, key, token)
292292
if err != nil {
293293
t.Fatalf("Failed to verify token: %v", err)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/kataras/jwt
22

3-
go 1.24.4
3+
go 1.25

jwt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ var Marshal = func(v any) ([]byte, error) {
265265
// - Uses json.Decoder with UseNumber() to handle integers correctly
266266
// - Prevents automatic conversion of all numbers to float64
267267
// - Preserves numeric precision for large integers
268-
// - Decodes JSON numbers as json.Number type when destination is interface{}
268+
// - Decodes JSON numbers as json.Number type when destination is any
269269
//
270270
// **Why UseNumber() Matters**:
271271
// - Standard json.Unmarshal converts all numbers to float64

verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ func verifyToken(alg Alg, key PublicKey, decrypt InjectFunc, token []byte, heade
482482
standardClaims = secondChange.toClaims()
483483
}
484484

485-
if err != nil { // do not proceed if we have a JSON error.
485+
if err == nil { // do not proceed if we have a JSON error.
486486
err = validateClaims(Clock(), standardClaims)
487487
}
488488

0 commit comments

Comments
 (0)