Skip to content

Commit de34730

Browse files
author
Daisuke Maki
committed
Merge branch 'develop/v2' into v2
2 parents 9e379c7 + b062940 commit de34730

File tree

79 files changed

+213
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+213
-198
lines changed

.github/workflows/assign-issue.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: 'Auto-assign issue'
11-
uses: pozil/auto-assign-issue@c5bca5027e680b9e8411b826d16947afd8c76b32 # v2.0.0
11+
uses: pozil/auto-assign-issue@39c06395cbac76e79afc4ad4e5c5c6db6ecfdd2e # v2.2.0
1212
with:
1313
assignees: lestrrat

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
strategy:
1212
matrix:
1313
go_tags: [ 'stdlib', 'goccy', 'es256k', 'secp256k1-pem', 'asmbase64', 'alltags']
14-
go: [ '1.23', '1.22', '1.21' ]
14+
go: [ '1.24', '1.23', '1.22' ]
1515
name: "Test [ Go ${{ matrix.go }} / Tags ${{ matrix.go_tags }} ]"
1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1919
- name: Cache Go modules
20-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
20+
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
2121
with:
2222
path: |
2323
~/go/pkg/mod

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
1010
with:
1111
go-version-file: "go.mod"
12-
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
12+
- uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
1313
- name: Run go vet
1414
run: |
1515
go vet ./...

.github/workflows/smoke.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
go_tags: [ 'stdlib', 'goccy', 'es256k', 'alltags' ]
17-
go: [ '1.23', '1.22', '1.21' ]
17+
go: [ '1.24', '1.23', '1.22' ]
1818
name: "Smoke [ Go ${{ matrix.go }} / Tags ${{ matrix.go_tags }} ]"
1919
steps:
2020
- name: Checkout repository
@@ -23,7 +23,7 @@ jobs:
2323
run: |
2424
find . -name '*.md' | xargs env AUTODOC_DRYRUN=1 perl tools/autodoc.pl
2525
- name: Cache Go modules
26-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.20
26+
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
2727
with:
2828
path: |
2929
~/go/pkg/mod

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
10+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1111
with:
1212
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
1313
stale-pr-message: 'This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.'

.golangci.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
run:
2-
31
linters-settings:
42
govet:
53
enable-all: true
@@ -92,7 +90,7 @@ issues:
9290
- forbidigo
9391
- path: /*_test.go
9492
text: "var-naming: "
95-
litners:
93+
linters:
9694
- revive
9795

9896
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.

Changes

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changes
44
v2 has many incompatibilities with v1. To see the full list of differences between
55
v1 and v2, please read the Changes-v2.md file (https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes-v2.md)
66

7+
v2.1.4 Feb 25 2025
8+
* Update code to work with go1.24
9+
* Update tests to work with recent latchset/jose
10+
* Fix build pipeline to work with latest golangci-lint
11+
712
v2.1.3 24 Nov 2024
813
* [jwe] Test has been fixed to work under 32-bit systems.
914

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import (
4545
"github.com/lestrrat-go/jwx/v2/jwt"
4646
)
4747

48-
func ExampleJWX() {
48+
func Example_jwx_readme() {
4949
// Parse, serialize, slice and dice JWKs!
5050
privkey, err := jwk.ParseKey(jsonRSAPrivateKey)
5151
if err != nil {

deps.bzl

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def go_dependencies():
1212
name = "com_github_decred_dcrd_crypto_blake256",
1313
build_file_proto_mode = "disable_global",
1414
importpath = "github.com/decred/dcrd/crypto/blake256",
15-
sum = "h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=",
16-
version = "v1.0.1",
15+
sum = "h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8=",
16+
version = "v1.1.0",
1717
)
1818
go_repository(
1919
name = "com_github_decred_dcrd_dcrec_secp256k1_v4",
2020
build_file_proto_mode = "disable_global",
2121
importpath = "github.com/decred/dcrd/dcrec/secp256k1/v4",
22-
sum = "h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=",
23-
version = "v4.3.0",
22+
sum = "h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=",
23+
version = "v4.4.0",
2424
)
2525
go_repository(
2626
name = "com_github_goccy_go_json",
@@ -92,8 +92,8 @@ def go_dependencies():
9292
name = "com_github_stretchr_testify",
9393
build_file_proto_mode = "disable_global",
9494
importpath = "github.com/stretchr/testify",
95-
sum = "h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=",
96-
version = "v1.9.0",
95+
sum = "h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=",
96+
version = "v1.10.0",
9797
)
9898

9999
go_repository(
@@ -115,8 +115,8 @@ def go_dependencies():
115115
name = "org_golang_x_crypto",
116116
build_file_proto_mode = "disable_global",
117117
importpath = "golang.org/x/crypto",
118-
sum = "h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=",
119-
version = "v0.29.0",
118+
sum = "h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=",
119+
version = "v0.32.0",
120120
)
121121

122122
go_repository(
@@ -131,21 +131,21 @@ def go_dependencies():
131131
name = "org_golang_x_sys",
132132
build_file_proto_mode = "disable_global",
133133
importpath = "golang.org/x/sys",
134-
sum = "h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=",
135-
version = "v0.27.0",
134+
sum = "h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=",
135+
version = "v0.29.0",
136136
)
137137
go_repository(
138138
name = "org_golang_x_term",
139139
build_file_proto_mode = "disable_global",
140140
importpath = "golang.org/x/term",
141-
sum = "h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=",
142-
version = "v0.26.0",
141+
sum = "h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=",
142+
version = "v0.28.0",
143143
)
144144

145145
go_repository(
146146
name = "org_golang_x_text",
147147
build_file_proto_mode = "disable_global",
148148
importpath = "golang.org/x/text",
149-
sum = "h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=",
150-
version = "v0.20.0",
149+
sum = "h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=",
150+
version = "v0.21.0",
151151
)

docs/01-jwt.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import (
8181
"github.com/lestrrat-go/jwx/v2/jwt"
8282
)
8383

84-
func ExampleJWT_Parse() {
84+
func Example_jwt_parse() {
8585
tok, err := jwt.Parse(jwtSignedWithHS256, jwt.WithKey(jwa.HS256, jwkSymmetricKey))
8686
if err != nil {
8787
fmt.Printf("%s\n", err)
@@ -112,7 +112,7 @@ import (
112112
"github.com/lestrrat-go/jwx/v2/jwt"
113113
)
114114

115-
func ExampleJWT_ReadFile() {
115+
func Example_jwt_readfile() {
116116
f, err := os.CreateTemp(``, `jwt_readfile-*.jws`)
117117
if err != nil {
118118
fmt.Printf("failed to create temporary file: %s\n", err)
@@ -154,7 +154,7 @@ import (
154154
"github.com/lestrrat-go/jwx/v2/jwt"
155155
)
156156

157-
func ExampleJWT_ParseRequest_Authorization() {
157+
func Example_jwt_parse_request_authorization() {
158158
req, err := http.NewRequest(http.MethodGet, `https://github.com/lestrrat-go/jwx`, nil)
159159
if err != nil {
160160
fmt.Printf("failed to create request: %s\n", err)
@@ -239,7 +239,7 @@ import (
239239
"github.com/lestrrat-go/jwx/v2/jwt"
240240
)
241241

242-
func ExampleJWT_Construct() {
242+
func Example_jwt_construct() {
243243
tok := jwt.New()
244244
if err := tok.Set(jwt.IssuerKey, `github.com/lestrrat-go/jwx`); err != nil {
245245
fmt.Printf("failed to set claim: %s\n", err)
@@ -284,7 +284,7 @@ import (
284284
"github.com/lestrrat-go/jwx/v2/jwt"
285285
)
286286

287-
func ExampleJWT_Builder() {
287+
func Example_jwt_builder() {
288288
tok, err := jwt.NewBuilder().
289289
Claim(`claim1`, `value1`).
290290
Claim(`claim2`, `value2`).
@@ -324,7 +324,7 @@ import (
324324
"github.com/lestrrat-go/jwx/v2/jwt"
325325
)
326326

327-
func ExampleJWT_ParseWithKey() {
327+
func Example_jwt_parse_with_key() {
328328
const keysrc = `{"kty":"oct","k":"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow"}`
329329

330330
key, err := jwk.ParseKey([]byte(keysrc))
@@ -369,7 +369,7 @@ import (
369369
"github.com/lestrrat-go/jwx/v2/jwt"
370370
)
371371

372-
func ExampleJWT_ParseWithKeySet() {
372+
func Example_jwt_parse_with_keyset() {
373373
var serialized []byte
374374
var signingKey jwk.Key
375375
var keyset jwk.Set
@@ -512,7 +512,7 @@ import (
512512
"github.com/lestrrat-go/jwx/v2/jwt"
513513
)
514514

515-
func ExampleJWT_ParseWithKeyProvider_UseToken() {
515+
func Example_jwt_parse_with_key_provider_use_token() {
516516
// This example shows how one might use the information in the JWT to
517517
// load different keys.
518518

@@ -581,7 +581,7 @@ func ExampleJWT_ParseWithKeyProvider_UseToken() {
581581
//
582582
}
583583

584-
func ExampleJWT_ParseWithKeyProvider() {
584+
func Example_jwt_parse_with_key_provider() {
585585
// Pretend that this is a storage somewhere (maybe a database) that maps
586586
// a signature algorithm to a key
587587
store := make(map[jwa.KeyAlgorithm]interface{})
@@ -666,7 +666,7 @@ import (
666666
"github.com/lestrrat-go/jwx/v2/jwt"
667667
)
668668

669-
func ExampleJWT_ParseWithJKU() {
669+
func Example_jwt_parse_with_jku() {
670670
set := jwk.NewSet()
671671

672672
var signingKey jwk.Key
@@ -753,7 +753,7 @@ import (
753753
"github.com/lestrrat-go/jwx/v2/jwt"
754754
)
755755

756-
func ExampleJWT_Validate() {
756+
func Example_validate_jwt() {
757757
tok, err := jwt.NewBuilder().
758758
Issuer(`github.com/lestrrat-go/jwx`).
759759
Expiration(time.Now().Add(-1 * time.Hour)).
@@ -813,7 +813,7 @@ import (
813813
"github.com/lestrrat-go/jwx/v2/jwt"
814814
)
815815

816-
func ExampleJWT_ValidateIssuer() {
816+
func Example_jwt_validate_issuer() {
817817
tok, err := jwt.NewBuilder().
818818
Issuer(`github.com/lestrrat-go/jwx`).
819819
Expiration(time.Now().Add(time.Hour)).
@@ -853,7 +853,7 @@ import (
853853
"github.com/lestrrat-go/jwx/v2/jwt"
854854
)
855855

856-
func ExampleJWT_ValidateValidator() {
856+
func Example_jwt_validate_validator() {
857857
validator := jwt.ValidatorFunc(func(_ context.Context, t jwt.Token) jwt.ValidationError {
858858
if t.IssuedAt().Month() != 8 {
859859
return jwt.NewValidationError(errors.New(`tokens are only valid if issued during August!`))
@@ -900,7 +900,7 @@ import (
900900
"github.com/lestrrat-go/jwx/v2/jwt"
901901
)
902902

903-
func ExampleJWT_ValidateDetectErrorType() {
903+
func Example_jwt_validate_detect_error_type() {
904904
tok, err := jwt.NewBuilder().
905905
Issuer(`github.com/lestrrat-go/jwx`).
906906
Expiration(time.Now().Add(-1 * time.Hour)).
@@ -982,7 +982,7 @@ import (
982982
"github.com/lestrrat-go/jwx/v2/jwt"
983983
)
984984

985-
func ExampleJWT_SerializeJSON() {
985+
func Example_jwt_serialize_json() {
986986
tok, err := jwt.NewBuilder().
987987
Issuer(`github.com/lestrrat-go/jwx`).
988988
IssuedAt(time.Unix(aLongLongTimeAgo, 0)).
@@ -1019,7 +1019,7 @@ import (
10191019
"github.com/lestrrat-go/jwx/v2/jwt"
10201020
)
10211021

1022-
func ExampleJWT_SerializeJWS() {
1022+
func Example_jwt_serialize_jws() {
10231023
tok, err := jwt.NewBuilder().
10241024
Issuer(`github.com/lestrrat-go/jwx`).
10251025
IssuedAt(time.Unix(aLongLongTimeAgo, 0)).
@@ -1085,7 +1085,7 @@ import (
10851085
"github.com/lestrrat-go/jwx/v2/jwt"
10861086
)
10871087

1088-
func ExampleJWT_SerializeJWEJWS() {
1088+
func Example_jwt_serialize_jwe_and_jws() {
10891089
tok, err := jwt.NewBuilder().
10901090
Issuer(`github.com/lestrrat-go/jwx`).
10911091
IssuedAt(time.Unix(aLongLongTimeAgo, 0)).
@@ -1164,7 +1164,7 @@ import (
11641164
"github.com/lestrrat-go/jwx/v2/jwt"
11651165
)
11661166

1167-
func ExampleJWT_FlattenAudience() {
1167+
func Example_jwt_flatten_audience() {
11681168
// Sometimes you need to "flatten" the "aud" claim because of
11691169
// parsers developed by people who apparently didn't read the RFC.
11701170
//
@@ -1262,7 +1262,7 @@ import (
12621262
"github.com/lestrrat-go/jwx/v2/jwt"
12631263
)
12641264

1265-
func ExampleJWTPlainStruct() {
1265+
func Example_jwt_plain_struct() {
12661266
t1, err := jwt.NewBuilder().
12671267
Issuer("https://github.com/lestrrat-go/jwx/v2/examples").
12681268
Subject("raw_struct").

0 commit comments

Comments
 (0)