-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
jwcrypto: type most of the rest of JWT
and JWKSet.generate
function
#13807
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
Conversation
This comment has been minimized.
This comment has been minimized.
stubs/jwcrypto/jwcrypto/jwk.pyi
Outdated
def generate(cls, **kwargs: Any) -> Self: ... | ||
def generate_key(self, **params) -> None: ... |
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.
Please note that we generally need documentation for each use of Any
. Also in this case, at least the required kty
argument should be added to the signature. And in theory it's possible to have overloads for the various kty
types to includes the extra arguments that some generator functions accept. Something like this:
def generate(cls, **kwargs: Any) -> Self: ... | |
def generate_key(self, **params) -> None: ... | |
# `kty` and the other keyword arguments are passed as `params` to the called generator | |
# function. The possible arguments depend on the value of `kty`. | |
# TODO: Add overloads for the individual `kty` values. | |
def generate(cls, *, kty: Literal["oct", "RSA", "EC", "OKP"], **kwargs) -> Self: ... | |
def generate_key(cls, *, kty: Literal["oct", "RSA", "EC", "OKP"], **kwargs) -> None: ... |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
5544378
to
d4df742
Compare
This comment has been minimized.
This comment has been minimized.
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.
Thanks!
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.
Thanks, nearly good to go, except that JWKKeyTypeSupported
, JWKOperationSupported
, and JWKUseSupported
need to be prefixed with an underscore, to mark that they are not available at runtime. This should also fix the CI failure.
d4df742
to
544f489
Compare
Oop, ya my bad, fixed up |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
No description provided.