-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |