diff --git a/libp2p/host/basic_host.py b/libp2p/host/basic_host.py index cd0d289..48c322b 100644 --- a/libp2p/host/basic_host.py +++ b/libp2p/host/basic_host.py @@ -67,6 +67,9 @@ class BasicHost(IHost): def get_public_key(self) -> PublicKey: return self.peerstore.pubkey(self.get_id()) + def get_private_key(self) -> PublicKey: + return self.peerstore.privkey(self.get_id()) + def get_network(self) -> INetwork: """ :return: network instance of host diff --git a/libp2p/host/host_interface.py b/libp2p/host/host_interface.py index cfba82c..5e28fda 100644 --- a/libp2p/host/host_interface.py +++ b/libp2p/host/host_interface.py @@ -24,6 +24,12 @@ class IHost(ABC): :return: the public key belonging to the peer """ + @abstractmethod + def get_private_key(self) -> PublicKey: + """ + :return: the private key belonging to the peer + """ + @abstractmethod def get_network(self) -> INetwork: """