beaconcrypt 0.4.3

Cryptographic transport for C2 channels
Documentation
from collections.abc import Sequence
from typing import final

@final
class BeaconCryptBeacon:
    def __new__(cls, /, server_kid: int, server_id_pk: bytes) -> BeaconCryptBeacon: ...
    def decrypt_server_message(self, /, data: Sequence[int]) -> bytes |None: ...
    def encrypt_message_to_server(self, /, data: Sequence[int]) -> bytes |None: ...
    def generate_registration(self, /) -> bytes |None:
        """
        Begin the beacon registration process. The output buffer should be sent as-is over the network.
        """
    def process_initial_message(self, /, data: Sequence[int]) -> bytes |None:
        """
        Process the registration response and optional initial data. The raw buffer sent by the server must be passed as-is as `data`.
        The response contains the contents of the initial message, or `0xFF` if there was none. Once this function returns, the beacon is registered
        """

@final
class BeaconCryptServer:
    def __new__(cls, /, kid: int, id_seed: bytes |None) -> BeaconCryptServer: ...
    def decrypt_and_update(self, /, data: Sequence[int]) -> EncryptState |None: ...
    def decrypt_and_update_json(self, /, data: Sequence[int]) -> str |None: ...
    def decrypt_beacon_message(self, /, data: Sequence[int]) -> bytes |None: ...
    def encrypt_and_update(self, /, data: Sequence[int], kid: int) -> EncryptState |None: ...
    def encrypt_and_update_json(self, /, data: Sequence[int], kid: int) -> str |None: ...
    def encrypt_to_beacon(self, /, data: Sequence[int], kid: int) -> bytes |None: ...
    def export_state(self, /) -> str |None: ...
    @staticmethod
    def from_state(server_state: str) -> BeaconCryptServer: ...
    def id_pk(self, /) -> bytes: ...
    def register_beacon(self, /, reg_buffer: bytes, initial_message: bytes |None) -> RegResponse |None: ...

@final
class EncryptState:
    def data(self, /) -> bytes: ...
    def key_id(self, /) -> int: ...
    def seq(self, /) -> int: ...
    def state(self, /) -> str:
        """
        Return the complete ratchet state as JSON.
        """

@final
class RegResponse:
    def key_id(self, /) -> int: ...
    def serialized(self, /) -> bytes: ...