Skip to content

Commit 97e0d3b

Browse files
lestrratDaisuke Maki
andauthored
[v3] Fixes to work with go1.24 (#1299)
* Update go versions * silence linter * Update go versions * fix typo * Work with go1.24 * rename examples to work with go1.24 * tweak test --------- Co-authored-by: Daisuke Maki <lestrrat+github@github.com>
1 parent 96737c5 commit 97e0d3b

File tree

61 files changed

+84
-69
lines changed

Some content is hidden

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

61 files changed

+84
-69
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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

.github/workflows/smoke.yml

Lines changed: 1 addition & 1 deletion
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.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

examples/jwe_decrypt_with_key_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/lestrrat-go/jwx/v3/jwe"
88
)
99

10-
func ExampleJWE_VerifyWithKey() {
10+
func Example_jwe_verify_with_key() {
1111
const payload = "Lorem ipsum"
1212
encrypted, err := jwe.Encrypt([]byte(payload), jwe.WithKey(jwa.RSA_OAEP(), jwkRSAPublicKey))
1313
if err != nil {

examples/jwe_decrypt_with_keyset_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/lestrrat-go/jwx/v3/jwk"
1111
)
1212

13-
func ExampleJWE_VerifyWithJWKSet() {
13+
func Example_jwe_verify_with_jwk_set() {
1414
privkey, err := rsa.GenerateKey(rand.Reader, 2048)
1515
if err != nil {
1616
fmt.Printf("failed to create private key: %s\n", err)

examples/jwe_encrypt_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/lestrrat-go/jwx/v3/jwk"
1111
)
1212

13-
func ExampleJWE_Encrypt() {
13+
func Example_jwe_encrypt() {
1414
rawprivkey, err := rsa.GenerateKey(rand.Reader, 2048)
1515
if err != nil {
1616
fmt.Printf("failed to create raw private key: %s\n", err)

examples/jwe_encrypt_json_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/lestrrat-go/jwx/v3/jwk"
1111
)
1212

13-
func ExampleJWE_EncryptJSON() {
13+
func Example_jwe_encrypt_json() {
1414
rawprivkey, err := rsa.GenerateKey(rand.Reader, 2048)
1515
if err != nil {
1616
fmt.Printf("failed to create raw private key: %s\n", err)
@@ -45,7 +45,7 @@ func ExampleJWE_EncryptJSON() {
4545
// Lorem ipsum
4646
}
4747

48-
func ExampleJWE_EncryptJSONMulti() {
48+
func Example_jwe_encrypt_json_multi() {
4949
var privkeys []jwk.Key
5050
var pubkeys []jwk.Key
5151

examples/jwe_encrypt_with_headers_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/lestrrat-go/jwx/v3/jwe"
1212
)
1313

14-
func ExampleJWE_SignWithHeaders() {
14+
func Example_jwe_sign_with_headers() {
1515
privkey, err := rsa.GenerateKey(rand.Reader, 2048)
1616
if err != nil {
1717
fmt.Printf("failed to create private key: %s\n", err)

examples/jwe_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func exampleGenPayload() (*rsa.PrivateKey, []byte, error) {
2727
return privkey, encrypted, nil
2828
}
2929

30-
func ExampleJWE_Decrypt() {
30+
func Example_jwe_decrypt() {
3131
privkey, encrypted, err := exampleGenPayload()
3232
if err != nil {
3333
log.Printf("failed to generate encrypted payload: %s", err)
@@ -47,7 +47,7 @@ func ExampleJWE_Decrypt() {
4747
// OUTPUT:
4848
}
4949

50-
func ExampleJWE_ComplexDecrypt() {
50+
func Example_jwe_complex_decrypt() {
5151
// WARNING: THIS USAGE IS NOT FOR A CASUAL USER. ONLY use it when you must.
5252
// Only use it when you understand how JWE is supposed to work. Only use it
5353
// when you understand the inner workings of this code.

examples/jwe_parse_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/lestrrat-go/jwx/v3/jwe"
99
)
1010

11-
func ExampleJWE_Parse() {
11+
func Example_jwe_parse() {
1212
const src = `eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.KrFTaMKVY_iUKYYk905QjbUf_fpBXvXCzIAfbPoPMGViDzxtgz5qnch8waV7wraVDfzpW7JfPOw6Nz_-XRwN3Vbud48bRYFw92GkC0M6kpKFpl_xgZxGN47ggNk9hzgqd7mFCuyufeYdn5c2fPoRZAV4UxvakLozEYcQo-eZaFmoYS4pyoC-IKKRikobW8n__LksMzXc_Vps1axn5kdpxsKQ4k1oayvUrgWX2PMxKn_TcLEKHtCN7qRlJ5hkKbZAXAdd34zGWcFV5gc1tcLs6HFhnebo8GUgItTYWBKSKzF6MyLJNRSUPFVq9q-Jxi1juXIlDrv_7rHVsdokQmBfvA.bK7z7Z3gEzFDgDQvNen0Ww.2hngnAVrmucUpJKLgIzYcg.CHs3ZP7JtG430Dl9YAKLMAl`
1313

1414
msg, err := jwe.Parse([]byte(src))

examples/jwe_readfile_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/lestrrat-go/jwx/v3/jwe"
99
)
1010

11-
func ExampleJWE_ReadFile() {
11+
func Example_jwe_readfile() {
1212
const src = `eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.KrFTaMKVY_iUKYYk905QjbUf_fpBXvXCzIAfbPoPMGViDzxtgz5qnch8waV7wraVDfzpW7JfPOw6Nz_-XRwN3Vbud48bRYFw92GkC0M6kpKFpl_xgZxGN47ggNk9hzgqd7mFCuyufeYdn5c2fPoRZAV4UxvakLozEYcQo-eZaFmoYS4pyoC-IKKRikobW8n__LksMzXc_Vps1axn5kdpxsKQ4k1oayvUrgWX2PMxKn_TcLEKHtCN7qRlJ5hkKbZAXAdd34zGWcFV5gc1tcLs6HFhnebo8GUgItTYWBKSKzF6MyLJNRSUPFVq9q-Jxi1juXIlDrv_7rHVsdokQmBfvA.bK7z7Z3gEzFDgDQvNen0Ww.2hngnAVrmucUpJKLgIzYcg.CHs3ZP7JtG430Dl9YAKLMAl`
1313

1414
f, err := os.CreateTemp(``, `jwe_readfile_example-*.jwe`)

0 commit comments

Comments
 (0)