-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update JWX lib to use v2 #308
Conversation
Codecov Report
@@ Coverage Diff @@
## main #308 +/- ##
==========================================
- Coverage 60.93% 58.68% -2.25%
==========================================
Files 42 42
Lines 4651 4717 +66
==========================================
- Hits 2834 2768 -66
- Misses 1367 1462 +95
- Partials 450 487 +37
|
* Add simple URL for parsing strings. * Add credential issuer metadata for oidc. * Make the linter happy * PR feedback * Finish comment * More PR comments * Even More PR comments * Enforce unique CredentialsSupported.ID ion models long form did and initial request
* Added style and best practices * nits deactivate request update request recover lint test not passing fix test fix reveal value; update test temp
func JWKFromPublicKeyJWK(key PublicKeyJWK) (jwk.Key, error) { | ||
keyBytes, err := json.Marshal(key) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return jwk.ParseKey(keyBytes) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why the PublicKeyJWK
and PrivateKeyJWK
structs are needed in the SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful to have full object model representations of each key type - especially when there's a need to construct these directly from signature suite test vectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly usage was from JsonWebKey2020
but it may be worth seeing if we can change it all to jwx.Key
in a follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #309
|
||
rsaJWKBytes, err := json.Marshal(rsaJWK) | ||
if err != nil { | ||
return nil, nil, errors.Wrap(err, "failed to marshal rsa jwk") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere. When wrapping, the failure will be evident by the root errors.
return nil, nil, errors.Wrap(err, "failed to marshal rsa jwk") | |
return nil, nil, errors.Wrap(err, "marshaling rsa jwk") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit
crypto/jwk.go
Outdated
} | ||
rsaJWK, ok := rsaJWKGeneric.(jwk.RSAPrivateKey) | ||
if !ok { | ||
return nil, nil, errors.New("casting rsa jwk") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For root cause errors, it's reasonable to include what you cannot do, or what exactly failed.
return nil, nil, errors.New("casting rsa jwk") | |
return nil, nil, errors.New("cannot cast to rsa jwk") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, d'oh!
* main: Bump github.com/goccy/go-json from 0.10.0 to 0.10.2 (#310) Bump golang.org/x/term from 0.5.0 to 0.6.0 (#299) Update JWX lib to use v2 (#308) # Conflicts: # credential/signing/jws.go # credential/signing/jwt.go # crypto/jwk_test.go # crypto/jwt.go # go.mod # go.sum # wasm/static/main.wasm
* origin/main: Bump github.com/multiformats/go-multibase from 0.1.1 to 0.2.0 (#313) Bump github.com/go-playground/validator/v10 from 10.11.2 to 10.12.0 (#311) Bump github.com/goccy/go-json from 0.10.0 to 0.10.2 (#310) Bump golang.org/x/term from 0.5.0 to 0.6.0 (#299) Update JWX lib to use v2 (#308) Added style and best practices (#298) Add models for Credential Issuer Metadata (#304) Upgrade go version to 1.20.2 (#305) add missing param (#297) interface to any (#296) # Conflicts: # cryptosuite/cryptosuite.go # cryptosuite/jsonwebkey2020.go # cryptosuite/jwssignaturesuite.go # cryptosuite/jwssignaturesuite_test.go # go.mod # go.sum # util/helpers.go # wasm/static/main.wasm
No description provided.