Skip to content

Commit

Permalink
fix jwx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Daisuke Maki committed Oct 7, 2024
1 parent 79cddb5 commit cce2543
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions jws/jws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,14 @@ func TestJKU(t *testing.T) {
for _, key := range []jwk.Key{unusedKeys[0], keys[1], unusedKeys[1]} {
pubkey, err := jwk.PublicKeyOf(key)
require.NoError(t, err, `jwk.PublicKeyOf should succeed`)
require.Equal(t, pubkey.KeyID(), key.KeyID(), `key ID should be populated`)

kid, ok := key.KeyID()
require.True(t, ok, `key ID should be populated`)

pubkid, ok := pubkey.KeyID()
require.True(t, ok, `key ID should be populated`)

require.Equal(t, kid, pubkid, `key ID should be populated`)
set.AddKey(pubkey)
}
srv := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
Expand Down Expand Up @@ -1844,7 +1851,8 @@ func TestValidateKey(t *testing.T) {
pubKey, err := jwk.PublicKeyOf(privKey)
require.NoError(t, err, `jwk.PublicKeyOf should succeed`)

n := pubKey.(jwk.RSAPublicKey).N()
n, ok := pubKey.(jwk.RSAPublicKey).N()
require.True(t, ok, `N should be present`)

// Set N to an empty value
require.NoError(t, pubKey.Set(jwk.RSANKey, []byte(nil)), `jwk.Set should succeed`)
Expand Down

0 comments on commit cce2543

Please sign in to comment.