libp2p.security.pnet package

Submodules

libp2p.security.pnet.protector module

libp2p.security.pnet.protector.new_protected_conn(conn: RawConnection | IRawConnection, psk: str) PskConn

libp2p.security.pnet.psk_conn module

class libp2p.security.pnet.psk_conn.PskConn(conn: RawConnection | IRawConnection, psk: str)

Bases: RawConnection

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

Delegate to the underlying stream’s get_remote_address method.

async read(n: int | None = None) bytes

Reads and decrypts data. On the first call, it reads a 8-byte nonce to initialize the decryption stream

async write(data: bytes) None

Encrpyts and writes data to the stream. On the first call, generates a 24-byte nonce and sends it first.

Module contents