Skip to content

Commit d1cdbf2

Browse files
committed
Change hash_method to Literal type in sign_hash()
1 parent 21c85d3 commit d1cdbf2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_rsa/pkcs1.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from adafruit_rsa import common, transform, core
2727

2828
try:
29-
from typing import Optional, Iterator, Union
29+
from typing import Optional, Iterator, Union, Literal
3030
from adafruit_rsa.key import PublicKey, PrivateKey
3131

3232
try:
@@ -260,7 +260,9 @@ def decrypt(crypto: bytes, priv_key: PrivateKey) -> bytes:
260260

261261

262262
def sign_hash(
263-
hash_value: Optional[bytes], priv_key: PrivateKey, hash_method: str
263+
hash_value: Optional[bytes],
264+
priv_key: PrivateKey,
265+
hash_method: Literal["MD5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512"],
264266
) -> bytes:
265267
"""Signs a precomputed hash with the private key.
266268

0 commit comments

Comments
 (0)