libp2p.security.insecure package

Subpackages

Submodules

libp2p.security.insecure.transport module

class libp2p.security.insecure.transport.InsecureSession(*, local_peer: ID, local_private_key: PrivateKey, remote_peer: ID, remote_permanent_pubkey: PublicKey, is_initiator: bool, conn: ReadWriteCloser)

Bases: BaseSession

async close() None
get_remote_address() tuple[str, int] | None

Delegate to the underlying connection’s get_remote_address method.

async read(n: int | None = None) bytes
async write(data: bytes) None
class libp2p.security.insecure.transport.InsecureTransport(local_key_pair: KeyPair, secure_bytes_provider: Callable[[int], bytes] | None = None, peerstore: IPeerStore | None = None)

Bases: BaseSecureTransport

Provides the “identity” upgrader for a IRawConnection, i.e. the upgraded transport does not add any additional security.

async secure_inbound(conn: IRawConnection) ISecureConn

Secure the connection, either locally or by communicating with opposing node via conn, for an inbound connection (i.e. we are not the initiator)

Returns:

secure connection object (that implements secure_conn_interface)

async secure_outbound(conn: IRawConnection, peer_id: ID) ISecureConn

Secure the connection, either locally or by communicating with opposing node via conn, for an inbound connection (i.e. we are the initiator)

Returns:

secure connection object (that implements secure_conn_interface)

class libp2p.security.insecure.transport.PlaintextHandshakeReadWriter(read_write_closer: ReadWriteCloser)

Bases: VarIntLengthMsgReadWriter

max_msg_size: int = 65536
libp2p.security.insecure.transport.make_exchange_message(pubkey: PublicKey) Exchange
async libp2p.security.insecure.transport.run_handshake(local_peer: ID, local_private_key: PrivateKey, conn: IRawConnection, is_initiator: bool, remote_peer_id: ID | None, peerstore: IPeerStore | None = None) ISecureConn

Raise HandshakeFailure when handshake failed.

Module contents