joserfc icon indicating copy to clipboard operation
joserfc copied to clipboard

Provide default size/crv for `JWKRegistry.generate_key`

Open azmeuk opened this issue 9 months ago • 0 comments

I noticed an inconsistency between specific key and JWKRegistry APIs on the generate_key method.

Specific key APIs provide default values for crv or size when calling generate_key, but not JWKRegistry.

>>> from joserfc import jwk
>>> jwk.RSAKey.generate_key()
<joserfc.rfc7518.rsa_key.RSAKey object at 0x7af0067afd90>
>>> jwk.JWKRegistry.generate_key("RSA")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: JWKRegistry.generate_key() missing 1 required positional argument: 'crv_or_size'

I would suggest to make the crv_or_size optional for JWKRegistry.generate_key too.

azmeuk avatar May 01 '25 17:05 azmeuk