Skip to content

Commit

Permalink
Merge branch 'develop/v2' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
lestrrat committed May 6, 2022
2 parents 8f97f60 + 23a2852 commit 0d365e4
Show file tree
Hide file tree
Showing 40 changed files with 593 additions and 138 deletions.
14 changes: 14 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Changes
v2 has many incompatibilities with v1. To see the full list of differences between
v1 and v2, please read the Changes-v2.md file (https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes-v2.md)

v2.0.1 - 06 May 2022
* [jwk] `jwk.Set` had erronously been documented as not returning an error
when the same key already exists in the set. This is a behavior change
since v2, and it was missing in the docs (#730)
* [jwt] `jwt.ErrMissingRequiredClaim` has been deprecated. Please use
`jwt.ErrRequiredClaim` instead.
* [jwt] `jwt.WithNumericDateParsePrecision` and `jwt.WithNumericDateFormatPrecision`
have been added to parse and format fractional seconds. These options can be
passed to `jwt.Settings`.
The default precision is set to 0, and fractional portions are not parsed nor
formatted. The precision may be set up to 9.
* `golang.org/x/crypto` has been upgraded (#724)
* `io/ioutil` has been removed from the source code.

v2.0.0 - 24 Apr 2022
* This i the first v2 release, which represents a set of design changes
that were learnt over the previous 2 years. As a result the v2 API
Expand Down
2 changes: 1 addition & 1 deletion Changes-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jwe.Verify(signed, jwe.WithKeySet(jwks), jwe.WithKeyUsed(&keyUsed))
* Field is now Get() (returns values for arbitrary fields other than keys). Fetching a key is done via Key()
* Remove() now removes arbitrary fields, not keys. to remove keys, use RemoveKey()
* Iterate has been added to iterate through all non-key fields.
* Add is now AddKey(Key) string
* Add is now AddKey(Key) string, and returns an error when the same key is added
* Get is now Key(int) (Key, bool)
* Remove is now RemoveKey(Key) error
* Iterate is now Keys(context.Context) KeyIterator
Expand Down
4 changes: 2 additions & 2 deletions bench/performance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
2 changes: 1 addition & 1 deletion cmd/jwx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/lestrrat-go/jwx/v2 v2.0.0-00010101000000-000000000000
github.com/urfave/cli/v2 v2.3.0
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
)

require (
Expand Down
4 changes: 2 additions & 2 deletions cmd/jwx/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
6 changes: 3 additions & 3 deletions cmd/jwx/jwe.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"io"

"github.com/lestrrat-go/jwx/v2/jwa"
"github.com/lestrrat-go/jwx/v2/jwe"
Expand Down Expand Up @@ -71,7 +71,7 @@ func makeJweEncryptCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
}
Expand Down Expand Up @@ -139,7 +139,7 @@ func makeJweDecryptCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/jwx/jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"

"github.com/lestrrat-go/jwx/v2/jwa"
"github.com/lestrrat-go/jwx/v2/jwk"
Expand Down Expand Up @@ -254,7 +253,7 @@ func makeJwkFormatCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/jwx/jws.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"

"github.com/lestrrat-go/jwx/v2/jwa"
Expand Down Expand Up @@ -55,7 +55,7 @@ func makeJwsParseCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
if err != nil {
Expand Down Expand Up @@ -151,7 +151,7 @@ func makeJwsVerifyCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
if err != nil {
Expand Down Expand Up @@ -240,7 +240,7 @@ func makeJwsSignCmd() *cli.Command {
}
defer src.Close()

buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return fmt.Errorf(`failed to read data from source: %w`, err)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/jwx/jwx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"sort"
"strings"
Expand Down Expand Up @@ -76,7 +75,7 @@ func dumpJSON(dst io.Writer, v interface{}) error {
func getSource(filename string) (io.ReadCloser, error) {
var src io.ReadCloser
if filename == "-" {
src = ioutil.NopCloser(os.Stdin)
src = io.NopCloser(os.Stdin)
} else {
if filename == "" {
return nil, fmt.Errorf(`filename required (use "-" to read from stdin)`)
Expand Down
3 changes: 1 addition & 2 deletions docs/01-jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ package examples_test

import (
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwt"
)

func ExampleJWT_ReadFile() {
f, err := ioutil.TempFile(``, `jwt_readfile-*.jws`)
f, err := os.CreateTemp(``, `jwt_readfile-*.jws`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions docs/02-jws.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jws"
)

func ExampleJWS_ReadFile() {
const src = `eyJhbGciOiJIUzI1NiJ9.TG9yZW0gaXBzdW0.idbECxA8ZhQbU0ddZmzdRZxQmHjwvw77lT2bwqGgNMo`
f, err := ioutil.TempFile(``, `jws_readfile-*.jws`)
f, err := os.CreateTemp(``, `jws_readfile-*.jws`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions docs/03-jwe.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwe"
Expand All @@ -73,7 +72,7 @@ import (
func ExampleJWE_ReadFile() {
const src = `eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.KrFTaMKVY_iUKYYk905QjbUf_fpBXvXCzIAfbPoPMGViDzxtgz5qnch8waV7wraVDfzpW7JfPOw6Nz_-XRwN3Vbud48bRYFw92GkC0M6kpKFpl_xgZxGN47ggNk9hzgqd7mFCuyufeYdn5c2fPoRZAV4UxvakLozEYcQo-eZaFmoYS4pyoC-IKKRikobW8n__LksMzXc_Vps1axn5kdpxsKQ4k1oayvUrgWX2PMxKn_TcLEKHtCN7qRlJ5hkKbZAXAdd34zGWcFV5gc1tcLs6HFhnebo8GUgItTYWBKSKzF6MyLJNRSUPFVq9q-Jxi1juXIlDrv_7rHVsdokQmBfvA.bK7z7Z3gEzFDgDQvNen0Ww.2hngnAVrmucUpJKLgIzYcg.CHs3ZP7JtG430Dl9YAKLMAl`

f, err := ioutil.TempFile(``, `jwe_readfile_example-*.jwe`)
f, err := os.CreateTemp(``, `jwe_readfile_example-*.jwe`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
6 changes: 2 additions & 4 deletions docs/04-jwk.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwk"
Expand All @@ -229,7 +228,7 @@ func ExampleJWK_ReadFile() {
]
}`

f, err := ioutil.TempFile(``, `jwk_readfile-*.jwk`)
f, err := os.CreateTemp(``, `jwk_readfile-*.jwk`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down Expand Up @@ -262,7 +261,6 @@ package examples_test

import (
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/internal/json"
Expand Down Expand Up @@ -298,7 +296,7 @@ z8CjezfckLs7UKJOlhu3OU9TFsiGDzSDBZdDWO1/uciJ/AAWeSmsBt8cKL0MirIr
c4wOvhbalcX0FqTM3mXCgMFRbibquhwdxbU=
-----END CERTIFICATE-----`

f, err := ioutil.TempFile(``, `jwk_readfile_with_pem-*.jwk`)
f, err := os.CreateTemp(``, `jwk_readfile_with_pem-*.jwk`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
4 changes: 2 additions & 2 deletions examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
3 changes: 1 addition & 2 deletions examples/jwe_readfile_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwe"
Expand All @@ -12,7 +11,7 @@ import (
func ExampleJWE_ReadFile() {
const src = `eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.KrFTaMKVY_iUKYYk905QjbUf_fpBXvXCzIAfbPoPMGViDzxtgz5qnch8waV7wraVDfzpW7JfPOw6Nz_-XRwN3Vbud48bRYFw92GkC0M6kpKFpl_xgZxGN47ggNk9hzgqd7mFCuyufeYdn5c2fPoRZAV4UxvakLozEYcQo-eZaFmoYS4pyoC-IKKRikobW8n__LksMzXc_Vps1axn5kdpxsKQ4k1oayvUrgWX2PMxKn_TcLEKHtCN7qRlJ5hkKbZAXAdd34zGWcFV5gc1tcLs6HFhnebo8GUgItTYWBKSKzF6MyLJNRSUPFVq9q-Jxi1juXIlDrv_7rHVsdokQmBfvA.bK7z7Z3gEzFDgDQvNen0Ww.2hngnAVrmucUpJKLgIzYcg.CHs3ZP7JtG430Dl9YAKLMAl`

f, err := ioutil.TempFile(``, `jwe_readfile_example-*.jwe`)
f, err := os.CreateTemp(``, `jwe_readfile_example-*.jwe`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions examples/jwk_readfile_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwk"
Expand All @@ -26,7 +25,7 @@ func ExampleJWK_ReadFile() {
]
}`

f, err := ioutil.TempFile(``, `jwk_readfile-*.jwk`)
f, err := os.CreateTemp(``, `jwk_readfile-*.jwk`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions examples/jwk_readfile_with_pem_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package examples_test

import (
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/internal/json"
Expand Down Expand Up @@ -38,7 +37,7 @@ z8CjezfckLs7UKJOlhu3OU9TFsiGDzSDBZdDWO1/uciJ/AAWeSmsBt8cKL0MirIr
c4wOvhbalcX0FqTM3mXCgMFRbibquhwdxbU=
-----END CERTIFICATE-----`

f, err := ioutil.TempFile(``, `jwk_readfile_with_pem-*.jwk`)
f, err := os.CreateTemp(``, `jwk_readfile_with_pem-*.jwk`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions examples/jws_readfile_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package examples_test
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jws"
)

func ExampleJWS_ReadFile() {
const src = `eyJhbGciOiJIUzI1NiJ9.TG9yZW0gaXBzdW0.idbECxA8ZhQbU0ddZmzdRZxQmHjwvw77lT2bwqGgNMo`
f, err := ioutil.TempFile(``, `jws_readfile-*.jws`)
f, err := os.CreateTemp(``, `jws_readfile-*.jws`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
3 changes: 1 addition & 2 deletions examples/jwt_readfile_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package examples_test

import (
"fmt"
"io/ioutil"
"os"

"github.com/lestrrat-go/jwx/v2/jwt"
)

func ExampleJWT_ReadFile() {
f, err := ioutil.TempFile(``, `jwt_readfile-*.jws`)
f, err := os.CreateTemp(``, `jwt_readfile-*.jws`)
if err != nil {
fmt.Printf("failed to create temporary file: %s\n", err)
return
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ require (
github.com/lestrrat-go/iter v1.0.2
github.com/lestrrat-go/option v1.0.0
github.com/stretchr/testify v1.7.1
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
7 changes: 3 additions & 4 deletions internal/jwxtest/jwxtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -168,7 +167,7 @@ func WriteJSONFile(template string, v interface{}) (string, func(), error) {
}

func DumpFile(t *testing.T, file string) {
buf, err := ioutil.ReadFile(file)
buf, err := os.ReadFile(file)
if !assert.NoError(t, err, `failed to read file %s for debugging`, file) {
return
}
Expand Down Expand Up @@ -217,7 +216,7 @@ func DumpFile(t *testing.T, file string) {
}

func CreateTempFile(template string) (*os.File, func(), error) {
file, err := ioutil.TempFile("", template)
file, err := os.CreateTemp("", template)
if err != nil {
return nil, nil, fmt.Errorf(`failed to create temporary file: %w`, err)
}
Expand All @@ -237,7 +236,7 @@ func ReadFile(file string) ([]byte, error) {
}
defer f.Close()

buf, err := ioutil.ReadAll(f)
buf, err := io.ReadAll(f)
if err != nil {
return nil, fmt.Errorf(`failed to read from key file %s: %w`, file, err)
}
Expand Down
Loading

0 comments on commit 0d365e4

Please sign in to comment.