Skip to content

Commit 2967d75

Browse files
committed
jwcrypto: type kty parameter and add TODO note
1 parent affd71e commit 2967d75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stubs/jwcrypto/jwcrypto/jwk.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ IANANamedInformationHashAlgorithmRegistry: dict[
7979
| hashes.BLAKE2b
8080
| None,
8181
]
82+
JWKKeyTypeSupported = Literal["oct", "RSA", "EC", "OKP"]
8283

8384
class InvalidJWKType(JWException):
8485
value: str | None
@@ -98,9 +99,12 @@ class InvalidJWKValue(JWException): ...
9899

99100
class JWK(dict[str, Any]):
100101
def __init__(self, **kwargs) -> None: ...
102+
# `kty` and the other keyword arguments are passed as `params` to the called generator
103+
# function. The possible arguments depend on the value of `kty`.
104+
# TODO: Add overloads for the individual `kty` values.
101105
@classmethod
102-
def generate(cls, **kwargs: Any) -> Self: ...
103-
def generate_key(self, **params) -> None: ...
106+
def generate(cls, kty: JWKKeyTypeSupported, **kwargs) -> Self: ...
107+
def generate_key(self, kty: JWKKeyTypeSupported, **kwargs) -> None: ...
104108
def import_key(self, **kwargs) -> None: ...
105109
@classmethod
106110
def from_json(cls, key) -> Self: ...

0 commit comments

Comments
 (0)