# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401

import builtins
import typing

@typing.final
class EndpointId:
    def __str__(self) -> builtins.str: ...

@typing.final
class IpAddress:
    def __str__(self) -> builtins.str: ...
    def ip_addr(self) -> builtins.str: ...
    def port(self) -> builtins.int: ...
    def zone_id(self) -> typing.Optional[builtins.int]: ...

@typing.final
class Keypair:
    @staticmethod
    def generate_ed25519() -> Keypair:
        r"""
        Generate a new Ed25519 keypair.
        """
    @staticmethod
    def from_postcard_encoding(bytes: bytes) -> Keypair:
        r"""
        Decode a postcard structure into a keypair
        """
    def to_postcard_encoding(self) -> bytes:
        r"""
        Encode a private key with the postcard format
        """
    def endpoint_id(self) -> EndpointId:
        r"""
        Read out the endpoint id corresponding to this keypair
        """

@typing.final
class RustConnectionMessage:
    @property
    def endpoint_id(self) -> EndpointId: ...
    @property
    def current_transport_addrs(self) -> typing.Optional[builtins.set[IpAddress]]: ...

@typing.final
class RustConnectionReceiver:
    async def receive(self) -> RustConnectionMessage: ...

@typing.final
class RustNetworkingHandle:
    @staticmethod
    async def create(identity: Keypair, namespace: builtins.str) -> RustNetworkingHandle: ...
    async def subscribe(self, topic: builtins.str) -> tuple[RustSender, RustReceiver]: ...
    async def get_connection_receiver(self) -> RustConnectionReceiver: ...

@typing.final
class RustReceiver:
    async def receive(self) -> bytes: ...

@typing.final
class RustSender:
    async def send(self, message: bytes) -> None: ...

