Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions stubs/jwcrypto/jwcrypto/jwk.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,23 @@ class InvalidJWKValue(JWException): ...

class JWK(dict[str, Any]):
unsafe_skip_rsa_key_validation: bool
@overload
def __init__(
self,
*,
generate: Literal["RSA"],
public_exponent: int | None = None,
size: int | None = None,
kid: str | None = None,
alg: str | None = None,
use: _JWKUseSupported | None = None,
key_ops: list[_JWKOperationSupported] | None = None,
) -> None: ...
@overload
def __init__(self, *, generate: Literal["oct", "EC", "OKP"], **kwargs) -> None: ...
@overload
def __init__(self, **kwargs) -> 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.
# TODO: __init__ may not be typed adequately because keyword arguments depend on the value of generate
@classmethod
@overload
def generate(
Expand Down Expand Up @@ -230,6 +243,7 @@ class JWK(dict[str, Any]):
@classmethod
def from_password(cls, password: str) -> Self: ...
def setdefault(self, key: str, default: _T | None = None) -> _T: ...
def __hash__(self) -> int: ... # type: ignore[override]

class JWKSet(dict[Literal["keys"], set[JWK]]):
@overload
Expand Down
Loading