Add get_private_key to Host

This commit is contained in:
NIC619 2019-11-25 16:57:00 +08:00
parent a63f00d8f8
commit e49de15227
No known key found for this signature in database
GPG Key ID: 570C35F5C2D51B17
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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:
"""