py-libp2p/libp2p/security/secure_conn_interface.py

36 lines
837 B
Python
Raw Normal View History

2019-04-27 19:42:05 -04:00
from abc import ABC, abstractmethod
2019-08-01 19:12:11 +08:00
from libp2p.crypto.keys import PrivateKey, PublicKey
2019-08-08 14:22:06 +08:00
from libp2p.network.connection.raw_connection_interface import IRawConnection
from libp2p.peer.id import ID
2019-08-01 19:12:11 +08:00
2019-05-01 13:54:19 -04:00
2019-04-27 19:42:05 -04:00
"""
Represents a secured connection object, which includes a connection and details about the security
involved in the secured connection
Relevant go repo: https://github.com/libp2p/go-conn-security/blob/master/interface.go
"""
2019-07-31 15:00:12 -07:00
class AbstractSecureConn(ABC):
2019-04-27 19:42:05 -04:00
@abstractmethod
def get_local_peer(self) -> ID:
pass
2019-04-27 19:42:05 -04:00
2019-04-29 18:05:38 -04:00
@abstractmethod
def get_local_private_key(self) -> PrivateKey:
pass
@abstractmethod
def get_remote_peer(self) -> ID:
pass
@abstractmethod
def get_remote_public_key(self) -> PublicKey:
pass
class ISecureConn(AbstractSecureConn, IRawConnection):
pass