Apply PR feedback: add_key_pair

This commit is contained in:
NIC619
2019-11-26 11:52:31 +08:00
parent 076dae50f3
commit 828ae69c66
4 changed files with 22 additions and 7 deletions

View File

@ -3,7 +3,7 @@ from typing import Any, List, Sequence, Set
from multiaddr import Multiaddr
from libp2p.crypto.keys import PrivateKey, PublicKey
from libp2p.crypto.keys import KeyPair, PrivateKey, PublicKey
from .addrbook_interface import IAddrBook
from .id import ID
@ -131,6 +131,14 @@ class IPeerStore(IAddrBook, IPeerMetadata):
:raise PeerStoreError: if peer ID not found
"""
@abstractmethod
def add_key_pair(self, peer_id: ID, key_pair: KeyPair) -> None:
"""
:param peer_id: peer ID to add private key for
:param key_pair:
:raise PeerStoreError: if peer ID already has pubkey or privkey set
"""
@abstractmethod
def peers_with_keys(self) -> Set[ID]:
"""