Skip to content

Commit 75740f1

Browse files
authored
replaced interface{} to any (#445)
* replaced interface{} to any in KeyFunc * replaced interface{} to its alias any * updated comments and MIGRATION_GUIDE.md file * replaced []any to []interface{} in test name because it is not a comment
1 parent 048854f commit 75740f1

28 files changed

+98
-98
lines changed

MIGRATION_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ stored in base64 encoded form, which was redundant with the information in the
155155
type Token struct {
156156
Raw string // Raw contains the raw token
157157
Method SigningMethod // Method is the signing method used or to be used
158-
Header map[string]interface{} // Header is the first segment of the token in decoded form
158+
Header map[string]any // Header is the first segment of the token in decoded form
159159
Claims Claims // Claims is the second segment of the token in decoded form
160160
Signature []byte // Signature is the third segment of the token in decoded form
161161
Valid bool // Valid specifies if the token is valid

cmd/jwt/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func loadData(p string) ([]byte, error) {
9999
}
100100

101101
// Print a json object in accordance with the prophecy (or the command line options)
102-
func printJSON(j interface{}) error {
102+
func printJSON(j any) error {
103103
var out []byte
104104
var err error
105105

@@ -132,7 +132,7 @@ func verifyToken() error {
132132
}
133133

134134
// Parse the token. Load the key from command line option
135-
token, err := jwt.Parse(string(tokData), func(t *jwt.Token) (interface{}, error) {
135+
token, err := jwt.Parse(string(tokData), func(t *jwt.Token) (any, error) {
136136
if isNone() {
137137
return jwt.UnsafeAllowNoneSignatureType, nil
138138
}
@@ -196,7 +196,7 @@ func signToken() error {
196196
}
197197

198198
// get the key
199-
var key interface{}
199+
var key any
200200
if isNone() {
201201
key = jwt.UnsafeAllowNoneSignatureType
202202
} else {

ecdsa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (m *SigningMethodECDSA) Alg() string {
5555

5656
// Verify implements token verification for the SigningMethod.
5757
// For this verify method, key must be an ecdsa.PublicKey struct
58-
func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interface{}) error {
58+
func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error {
5959
// Get the key
6060
var ecdsaKey *ecdsa.PublicKey
6161
switch k := key.(type) {
@@ -89,7 +89,7 @@ func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interf
8989

9090
// Sign implements token signing for the SigningMethod.
9191
// For this signing method, key must be an ecdsa.PrivateKey struct
92-
func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) ([]byte, error) {
92+
func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) {
9393
// Get the key
9494
var ecdsaKey *ecdsa.PrivateKey
9595
switch k := key.(type) {

ecdsa_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@ var ecdsaTestData = []struct {
1515
keys map[string]string
1616
tokenString string
1717
alg string
18-
claims map[string]interface{}
18+
claims map[string]any
1919
valid bool
2020
}{
2121
{
2222
"Basic ES256",
2323
map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"},
2424
"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJmb28iOiJiYXIifQ.feG39E-bn8HXAKhzDZq7yEAPWYDhZlwTn3sePJnU9VrGMmwdXAIEyoOnrjreYlVM_Z4N13eK9-TmMTWyfKJtHQ",
2525
"ES256",
26-
map[string]interface{}{"foo": "bar"},
26+
map[string]any{"foo": "bar"},
2727
true,
2828
},
2929
{
3030
"Basic ES384",
3131
map[string]string{"private": "test/ec384-private.pem", "public": "test/ec384-public.pem"},
3232
"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJmb28iOiJiYXIifQ.ngAfKMbJUh0WWubSIYe5GMsA-aHNKwFbJk_wq3lq23aPp8H2anb1rRILIzVR0gUf4a8WzDtrzmiikuPWyCS6CN4-PwdgTk-5nehC7JXqlaBZU05p3toM3nWCwm_LXcld",
3333
"ES384",
34-
map[string]interface{}{"foo": "bar"},
34+
map[string]any{"foo": "bar"},
3535
true,
3636
},
3737
{
3838
"Basic ES512",
3939
map[string]string{"private": "test/ec512-private.pem", "public": "test/ec512-public.pem"},
4040
"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzUxMiJ9.eyJmb28iOiJiYXIifQ.AAU0TvGQOcdg2OvrwY73NHKgfk26UDekh9Prz-L_iWuTBIBqOFCWwwLsRiHB1JOddfKAls5do1W0jR_F30JpVd-6AJeTjGKA4C1A1H6gIKwRY0o_tFDIydZCl_lMBMeG5VNFAjO86-WCSKwc3hqaGkq1MugPRq_qrF9AVbuEB4JPLyL5",
4141
"ES512",
42-
map[string]interface{}{"foo": "bar"},
42+
map[string]any{"foo": "bar"},
4343
true,
4444
},
4545
{
4646
"basic ES256 invalid: foo => bar",
4747
map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"},
4848
"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.MEQCIHoSJnmGlPaVQDqacx_2XlXEhhqtWceVopjomc2PJLtdAiAUTeGPoNYxZw0z8mgOnnIcjoxRuNDVZvybRZF3wR1l8W",
4949
"ES256",
50-
map[string]interface{}{"foo": "bar"},
50+
map[string]any{"foo": "bar"},
5151
false,
5252
},
5353
}

ecdsa_utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
2323
}
2424

2525
// Parse the key
26-
var parsedKey interface{}
26+
var parsedKey any
2727
if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
2828
if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
2929
return nil, err
@@ -50,7 +50,7 @@ func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
5050
}
5151

5252
// Parse the key
53-
var parsedKey interface{}
53+
var parsedKey any
5454
if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
5555
if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
5656
parsedKey = cert.PublicKey

ed25519.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (m *SigningMethodEd25519) Alg() string {
3333

3434
// Verify implements token verification for the SigningMethod.
3535
// For this verify method, key must be an ed25519.PublicKey
36-
func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key interface{}) error {
36+
func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error {
3737
var ed25519Key ed25519.PublicKey
3838
var ok bool
3939

@@ -55,7 +55,7 @@ func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key inte
5555

5656
// Sign implements token signing for the SigningMethod.
5757
// For this signing method, key must be an ed25519.PrivateKey
58-
func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) ([]byte, error) {
58+
func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) {
5959
var ed25519Key crypto.Signer
6060
var ok bool
6161

ed25519_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ var ed25519TestData = []struct {
1313
keys map[string]string
1414
tokenString string
1515
alg string
16-
claims map[string]interface{}
16+
claims map[string]any
1717
valid bool
1818
}{
1919
{
2020
"Basic Ed25519",
2121
map[string]string{"private": "test/ed25519-private.pem", "public": "test/ed25519-public.pem"},
2222
"eyJhbGciOiJFRDI1NTE5IiwidHlwIjoiSldUIn0.eyJmb28iOiJiYXIifQ.ESuVzZq1cECrt9Od_gLPVG-_6uRP_8Nq-ajx6CtmlDqRJZqdejro2ilkqaQgSL-siE_3JMTUW7UwAorLaTyFCw",
2323
"EdDSA",
24-
map[string]interface{}{"foo": "bar"},
24+
map[string]any{"foo": "bar"},
2525
true,
2626
},
2727
{
2828
"Basic Ed25519",
2929
map[string]string{"private": "test/ed25519-private.pem", "public": "test/ed25519-public.pem"},
3030
"eyJhbGciOiJFRDI1NTE5IiwidHlwIjoiSldUIn0.eyJmb28iOiJiYXoifQ.ESuVzZq1cECrt9Od_gLPVG-_6uRP_8Nq-ajx6CtmlDqRJZqdejro2ilkqaQgSL-siE_3JMTUW7UwAorLaTyFCw",
3131
"EdDSA",
32-
map[string]interface{}{"foo": "bar"},
32+
map[string]any{"foo": "bar"},
3333
false,
3434
},
3535
}

ed25519_utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
2424
}
2525

2626
// Parse the key
27-
var parsedKey interface{}
27+
var parsedKey any
2828
if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
2929
return nil, err
3030
}
@@ -49,7 +49,7 @@ func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
4949
}
5050

5151
// Parse the key
52-
var parsedKey interface{}
52+
var parsedKey any
5353
if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
5454
return nil, err
5555
}

example_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func ExampleParseWithClaims_customClaimsType() {
8484
jwt.RegisteredClaims
8585
}
8686

87-
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
87+
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (any, error) {
8888
return []byte("AllYourBase"), nil
8989
})
9090
if err != nil {
@@ -108,7 +108,7 @@ func ExampleParseWithClaims_validationOptions() {
108108
jwt.RegisteredClaims
109109
}
110110

111-
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
111+
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (any, error) {
112112
return []byte("AllYourBase"), nil
113113
}, jwt.WithLeeway(5*time.Second))
114114
if err != nil {
@@ -147,7 +147,7 @@ func (m MyCustomClaims) Validate() error {
147147
func ExampleParseWithClaims_customValidation() {
148148
tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJpc3MiOiJ0ZXN0IiwiYXVkIjoic2luZ2xlIn0.QAWg1vGvnqRuCFTMcPkjZljXHh8U3L_qUjszOtQbeaA"
149149

150-
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) {
150+
token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (any, error) {
151151
return []byte("AllYourBase"), nil
152152
}, jwt.WithLeeway(5*time.Second))
153153
if err != nil {
@@ -166,7 +166,7 @@ func ExampleParse_errorChecking() {
166166
// Token from another example. This token is expired
167167
var tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c"
168168

169-
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
169+
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (any, error) {
170170
return []byte("AllYourBase"), nil
171171
})
172172

hmac.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (m *SigningMethodHMAC) Alg() string {
5555
// about this, and why we intentionally are not supporting string as a key can
5656
// be found on our usage guide
5757
// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types.
58-
func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interface{}) error {
58+
func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key any) error {
5959
// Verify the key is the right type
6060
keyBytes, ok := key.([]byte)
6161
if !ok {
@@ -88,7 +88,7 @@ func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interfa
8888
// cryptographically random source, e.g. crypto/rand. Additional information
8989
// about this, and why we intentionally are not supporting string as a key can
9090
// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/.
91-
func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) {
91+
func (m *SigningMethodHMAC) Sign(signingString string, key any) ([]byte, error) {
9292
if keyBytes, ok := key.([]byte); ok {
9393
if !m.Hash.Available() {
9494
return nil, ErrHashUnavailable

hmac_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func ExampleParse_hmac() {
4848
// useful if you use multiple keys for your application. The standard is to use 'kid' in the
4949
// head of the token to identify which key to use, but the parsed token (head and claims) is provided
5050
// to the callback, providing flexibility.
51-
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
51+
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (any, error) {
5252
// hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key")
5353
return hmacSampleSecret, nil
5454
}, jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}))

hmac_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,35 @@ var hmacTestData = []struct {
1313
name string
1414
tokenString string
1515
alg string
16-
claims map[string]interface{}
16+
claims map[string]any
1717
valid bool
1818
}{
1919
{
2020
"web sample",
2121
"eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
2222
"HS256",
23-
map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
23+
map[string]any{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
2424
true,
2525
},
2626
{
2727
"HS384",
2828
"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.KWZEuOD5lbBxZ34g7F-SlVLAQ_r5KApWNWlZIIMyQVz5Zs58a7XdNzj5_0EcNoOy",
2929
"HS384",
30-
map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
30+
map[string]any{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
3131
true,
3232
},
3333
{
3434
"HS512",
3535
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.CN7YijRX6Aw1n2jyI2Id1w90ja-DEMYiWixhYCyHnrZ1VfJRaFQz1bEbjjA5Fn4CLYaUG432dEYmSbS4Saokmw",
3636
"HS512",
37-
map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
37+
map[string]any{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
3838
true,
3939
},
4040
{
4141
"web sample: invalid",
4242
"eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXo",
4343
"HS256",
44-
map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
44+
map[string]any{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true},
4545
false,
4646
},
4747
}

http_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func Example_getTokenViaHTTP() {
9696
tokenString := strings.TrimSpace(string(buf))
9797

9898
// Parse the token
99-
token, err := jwt.ParseWithClaims(tokenString, &CustomClaimsExample{}, func(token *jwt.Token) (interface{}, error) {
99+
token, err := jwt.ParseWithClaims(tokenString, &CustomClaimsExample{}, func(token *jwt.Token) (any, error) {
100100
// since we only use the one private key to sign the tokens,
101101
// we also only use its public counter part to verify
102102
return verifyKey, nil
@@ -188,7 +188,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
188188
// only accessible with a valid token
189189
func restrictedHandler(w http.ResponseWriter, r *http.Request) {
190190
// Get token from request
191-
token, err := request.ParseFromRequest(r, request.OAuth2Extractor, func(token *jwt.Token) (interface{}, error) {
191+
token, err := request.ParseFromRequest(r, request.OAuth2Extractor, func(token *jwt.Token) (any, error) {
192192
// since we only use the one private key to sign the tokens,
193193
// we also only use its public counter part to verify
194194
return verifyKey, nil

map_claims.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"fmt"
66
)
77

8-
// MapClaims is a claims type that uses the map[string]interface{} for JSON
8+
// MapClaims is a claims type that uses the map[string]any for JSON
99
// decoding. This is the default claims type if you don't supply one
10-
type MapClaims map[string]interface{}
10+
type MapClaims map[string]any
1111

1212
// GetExpirationTime implements the Claims interface.
1313
func (m MapClaims) GetExpirationTime() (*NumericDate, error) {
@@ -73,7 +73,7 @@ func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) {
7373
cs = append(cs, v)
7474
case []string:
7575
cs = v
76-
case []interface{}:
76+
case []any:
7777
for _, a := range v {
7878
vs, ok := a.(string)
7979
if !ok {
@@ -92,7 +92,7 @@ func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) {
9292
func (m MapClaims) parseString(key string) (string, error) {
9393
var (
9494
ok bool
95-
raw interface{}
95+
raw any
9696
iss string
9797
)
9898
raw, ok = m[key]

map_claims_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
)
77

88
func TestVerifyAud(t *testing.T) {
9-
var nilInterface interface{}
10-
var nilListInterface []interface{}
11-
var intListInterface interface{} = []int{1, 2, 3}
9+
var nilInterface any
10+
var nilListInterface []any
11+
var intListInterface any = []int{1, 2, 3}
1212
type test struct {
1313
Name string
1414
MapClaims MapClaims
@@ -47,13 +47,13 @@ func TestVerifyAud(t *testing.T) {
4747
// Required = false
4848
{Name: "Empty []String Aud without match required", MapClaims: MapClaims{"aud": []string{""}}, Expected: true, Required: false, Comparison: []string{"example.com"}},
4949

50-
// []interface{}
50+
// []any
5151
{Name: "Empty []interface{} Aud without match required", MapClaims: MapClaims{"aud": nilListInterface}, Expected: true, Required: false, Comparison: []string{"example.com"}},
52-
{Name: "[]interface{} Aud with match required", MapClaims: MapClaims{"aud": []interface{}{"a", "foo", "example.com"}}, Expected: true, Required: true, Comparison: []string{"example.com"}},
53-
{Name: "[]interface{} Aud with match but invalid types", MapClaims: MapClaims{"aud": []interface{}{"a", 5, "example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com"}},
52+
{Name: "[]interface{} Aud with match required", MapClaims: MapClaims{"aud": []any{"a", "foo", "example.com"}}, Expected: true, Required: true, Comparison: []string{"example.com"}},
53+
{Name: "[]interface{} Aud with match but invalid types", MapClaims: MapClaims{"aud": []any{"a", 5, "example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com"}},
5454
{Name: "[]interface{} Aud int with match required", MapClaims: MapClaims{"aud": intListInterface}, Expected: false, Required: true, Comparison: []string{"example.com"}},
5555

56-
// interface{}
56+
// any
5757
{Name: "Empty interface{} Aud without match not required", MapClaims: MapClaims{"aud": nilInterface}, Expected: true, Required: false, Comparison: []string{"example.com"}},
5858
}
5959

none.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (m *signingMethodNone) Alg() string {
2525
}
2626

2727
// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
28-
func (m *signingMethodNone) Verify(signingString string, sig []byte, key interface{}) (err error) {
28+
func (m *signingMethodNone) Verify(signingString string, sig []byte, key any) (err error) {
2929
// Key must be UnsafeAllowNoneSignatureType to prevent accidentally
3030
// accepting 'none' signing method
3131
if _, ok := key.(unsafeNoneMagicConstant); !ok {
@@ -41,7 +41,7 @@ func (m *signingMethodNone) Verify(signingString string, sig []byte, key interfa
4141
}
4242

4343
// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
44-
func (m *signingMethodNone) Sign(signingString string, key interface{}) ([]byte, error) {
44+
func (m *signingMethodNone) Sign(signingString string, key any) ([]byte, error) {
4545
if _, ok := key.(unsafeNoneMagicConstant); ok {
4646
return []byte{}, nil
4747
}

0 commit comments

Comments
 (0)