Mock dependencies that are excluded in readthedocs

It seems preferable to import just fastecdsa. But if you do that,
then some kind of side-effect doesn't happen, which means that `sec1` is
not available as an attribute on `fastecdsa.encoding`.

So we specifically mock the sub-modules as well.
This commit is contained in:
Jason Carver
2019-11-27 12:25:11 -08:00
parent 3e5f883c50
commit 27ecd4b0ed
2 changed files with 19 additions and 1 deletions

View File

@ -1,12 +1,14 @@
from typing import Callable, Tuple, cast
from fastecdsa.encoding.util import int_bytelen
from fastecdsa.encoding import util
from libp2p.crypto.ecc import ECCPrivateKey, ECCPublicKey, create_new_key_pair
from libp2p.crypto.keys import PublicKey
SharedKeyGenerator = Callable[[bytes], bytes]
int_bytelen = util.int_bytelen
def create_ephemeral_key_pair(curve_type: str) -> Tuple[PublicKey, SharedKeyGenerator]:
"""Facilitates ECDH key exchange."""