Replies: 2 comments 4 replies
-
|
@spbooth Does this section of the docs help: https://github.com/jwtk/jjwt?tab=readme-ov-file#creating-safe-keys |
Beta Was this translation helpful? Give feedback.
-
|
The But your use case is a little more targeted and specific beyond this convenience, so it probably makes sense to specifically choose the algorithm explicitly and use the Thinking about new additions or conveniences like a new A JWK Based on this, it seems like there should probably be If the argument is a My thinking is that two separate Thoughts? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to generate a PublicJWK with the algorithm field set to the same algorithm that the library will auto-select when signing a JWT with the corresponding private key. However the only accessible method I can find io.jsonwebtoken.SignatureAlgorithm.forSigningKey(Key) is from a deprecated class. It seems wrong to duplicate the algorithm selection logic if I let the library pick when generating JWTs.
Would it make sense for DynamicJwkBuilder to have a algorithmFromSigningKey(Key) method, or am I missing an easy way to do this?
I don't see a simple way of generating the algorithm automatically because you need the private key to determine the key bit-count and as its a PublicJWK it only contains the public key. Obviously this is only needed if you are going to let the algorithm auto-select when generating JWTs.
Beta Was this translation helpful? Give feedback.
All reactions