Skip to content

Commit

Permalink
Fix typing for key_agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Oct 28, 2023
1 parent c8663ed commit 00a6287
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/Crypto/Protocol/DH.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import TypedDict, Callable
from typing_extensions import Unpack
from typing import TypedDict, Callable, TypeVar, Generic
from typing_extensions import Unpack, NotRequired

from Crypto.PublicKey.ECC import EccKey

PRF = Callable[[bytes|bytearray|memoryview], bytes]
T = TypeVar('T')

class RequestParams(TypedDict):
kdf: PRF
static_priv: EccKey
static_pub: EccKey
eph_priv: EccKey
eph_pub: EccKey
class RequestParams(TypedDict, Generic[T]):
kdf: Callable[[bytes|bytearray|memoryview], T]
static_priv: NotRequired[EccKey]
static_pub: NotRequired[EccKey]
eph_priv: NotRequired[EccKey]
eph_pub: NotRequired[EccKey]

def key_agreement(**kwargs: Unpack[RequestParams]) -> bytes: ...
def key_agreement(**kwargs: Unpack[RequestParams[T]]) -> T: ...

0 comments on commit 00a6287

Please sign in to comment.