Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: enable ed25519 in jwkkid.BuildJWK() #3450

Merged
merged 2 commits into from
Dec 19, 2022

Conversation

Moopli
Copy link
Contributor

@Moopli Moopli commented Dec 19, 2022

Signed-off-by: Filip Burlacu [email protected]

@@ -52,6 +52,8 @@ func CreateKID(keyBytes []byte, kt kms.KeyType) (string, error) {

return x25519KID, nil
case kms.ED25519Type: // go-jose JWK thumbprint of Ed25519 has a bug, manually build it and build its resulting KID.
// TODO remove `case kms.ED25519Type` when go-jose fixes Ed25519 JWK thumbprint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go jose already implemented the fix, need to update the dep and remove this case fully since j.Thumbprint() below will handle the correct ED25519 type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What go-jose version added the fix? If we update, do we want to update to latest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It dosen't hurt to be at latest.. but I'll check the version when it was updated

Copy link
Contributor

@baha-ai baha-ai Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I could swear to have seen that they fixed it. It doesn't seem to be fixed yet: https://github.com/square/go-jose/blob/v2/jwk.go#L335

it still uses a bad ed25519 jwk string for thumbnail template (missing " before x)

Copy link
Contributor

@baha-ai baha-ai Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh... the repo name is different: github.com/go-jose/go-jose

see the fix here: https://github.com/go-jose/go-jose/blob/v3/jwk.go#L341
commit: fa705ca80d23fff27c333fb6475d30047e032200

need to update the go-jose to this new repo instead, the newer v3 has the fix.
square/go-jose is the legacy repo

@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Merging #3450 (d4a22c4) into main (89ac465) will increase coverage by 0.01%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##             main    #3450      +/-   ##
==========================================
+ Coverage   87.58%   87.59%   +0.01%     
==========================================
  Files         346      346              
  Lines       47011    46992      -19     
==========================================
- Hits        41174    41163      -11     
+ Misses       4334     4327       -7     
+ Partials     1503     1502       -1     
Impacted Files Coverage Δ
pkg/crypto/tinkcrypto/key_wrapper.go 82.89% <ø> (ø)
...rypto/primitive/aead/subtle/gojose_aes_cbc_hmac.go 72.72% <ø> (ø)
pkg/crypto/tinkcrypto/wrap_support.go 93.19% <ø> (ø)
pkg/didcomm/protocol/didexchange/keys.go 85.29% <ø> (ø)
pkg/didcomm/protocol/outofbandv2/service.go 74.45% <ø> (ø)
pkg/doc/jose/encrypter.go 86.55% <ø> (ø)
pkg/doc/jose/jwk/jwk.go 86.31% <ø> (ø)
pkg/doc/jose/jwk/jwksupport/jwk.go 92.85% <ø> (ø)
pkg/doc/jose/jws.go 94.20% <ø> (ø)
pkg/doc/jwt/jwt.go 98.23% <ø> (ø)
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

// if err != nil {
// return nil, fmt.Errorf("buildJWK: failed to build JWK from ed25519 key: %w", err)
// }
case kms.ED25519Type:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good to uncomment, but go-jose needs to be updated to pick up the fixed thumbprint computation as mentioned in the previous comment.

@sudeshrshetty sudeshrshetty merged commit fdd5069 into hyperledger-archives:main Dec 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants