Skip to content

Commit

Permalink
fix type hint of gen_key_and_iv
Browse files Browse the repository at this point in the history
  • Loading branch information
tex2e committed Jun 11, 2023
1 parent 6f454bc commit 2f71c07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto_hkdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# * https://datatracker.ietf.org/doc/html/rfc8446#section-7.1
# ------------------------------------------------------------------------------

from typing import Tuple
import hmac
import hashlib
from metatype import Uint8, Uint16, Opaque
Expand Down Expand Up @@ -122,7 +123,7 @@ def transcript_hash(messages: bytes, hash_name='sha256') -> bytearray:
assert isinstance(messages, (bytes, bytearray))
return secure_hash(messages, hash_name)

def gen_key_and_iv(secret: bytes, key_size: bytes, nonce_size: int, hash_name='sha256') -> list[bytes]:
def gen_key_and_iv(secret: bytes, key_size: bytes, nonce_size: int, hash_name='sha256') -> Tuple[bytes, bytes]:
write_key = HKDF_expand_label(secret, b'key', b'', key_size, hash_name)
write_iv = HKDF_expand_label(secret, b'iv', b'', nonce_size, hash_name)
return write_key, write_iv
Expand Down

0 comments on commit 2f71c07

Please sign in to comment.