bitchat


Namebitchat JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryPython implementation of the bitchat mesh networking protocol
upload_time2025-07-09 16:20:36
maintainerNone
docs_urlNone
authorNguyen Truong Long
requires_python<4.0,>=3.7
licenseUnlicense
keywords bitchat mesh-networking ble encryption
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bitchat Python Library

A secure, decentralized mesh networking library implementing the Bitchat protocol, as described in [Jack Dorsey’s Bitchat Whitepaper](https://github.com/jackjackbits/bitchat/blob/main/WHITEPAPER.md). It supports Bluetooth Low Energy (BLE) communication, message encryption, delivery tracking, channel management, and password-protected channels for privacy-preserving, peer-to-peer messaging.

<img src="https://badge.fury.io/py/bitchat.svg" alt="PyPI Version">
<img src="https://readthedocs.org/projects/bitchat-py/badge/?version=latest" alt="Documentation">

## Installation

Install the library using pip:

<code>pip3 install bitchat</code>

## Usage

The Bitchat Python Library provides a robust set of tools for building decentralized, secure messaging applications with BLE-based mesh networking. Below are comprehensive examples and parameter explanations for all public methods and classes, designed to guide Python GUI developers (e.g., using Tkinter, PyQt, or Kivy) in integrating the library. The examples avoid redundancy by covering distinct use cases: public channel messaging, private messaging, encrypted channel messaging, and delivery tracking.

### Key Classes and Structures

The library exports the following classes from the `bitchat` module, used to construct and manage messages, packets, and channels:

- **BitchatPacket**: Represents a network packet for BLE transmission.
  - `version: int`: Protocol version (must be 1).
  - `type: str`: Packet type (`"message"`, `"ack"`, `"receipt"`).
  - `sender_id: str`: 8-byte unique sender identifier (e.g., `"peer123"`).
  - `recipient_id: str`: 8-byte recipient identifier or `"\xFF" * 8` for broadcast.
  - `timestamp: int`: Unix timestamp (seconds).
  - `payload: bytes`: Encoded message, ACK, or receipt.
  - `signature: bytes`: 64-byte signature for authenticity.
  - `ttl: int`: Time-to-live (hops, e.g., 5).

- **BitchatMessage**: Represents a message in the Bitchat protocol.
  - `id: str`: Unique message ID (e.g., UUID from `uuid4()`).
  - `sender: str`: Sender’s display name (e.g., `"alice"`).
  - `content: str`: Message text (empty for encrypted messages).
  - `timestamp: int`: Unix timestamp (seconds).
  - `is_relay: bool`: True if message is relayed by another peer.
  - `original_sender: str | None`: Original sender’s name for relayed messages.
  - `is_private: bool`: True for private messages to a specific recipient.
  - `recipient_nickname: str | None`: Recipient’s display name for private messages.
  - `sender_peer_id: str`: Sender’s unique peer ID (e.g., `"bitchat_peer1"`).
  - `mentions: List[str]`: List of mentioned user names (e.g., `["bob", "charlie"]`).
  - `channel: str | None`: Channel name (e.g., `"#general"`, regex: `^#[a-zA-Z0-9-]+$`).
  - `encrypted_content: bytes | None`: Encrypted message content for secure channels.
  - `is_encrypted: bool`: True if message uses `encrypted_content`.
  - `delivery_status: str`: Status (`"PENDING"`, `"DELIVERED"`, `"READ"`).

- **DeliveryAck**: Acknowledgment of message delivery.
  - `message_id: str`: ID of the acknowledged message.
  - `recipient_id: str`: Recipient’s peer ID.
  - `nickname: str`: Recipient’s display name.
  - `hop_count: int`: Number of hops the message traveled.

- **ReadReceipt**: Confirmation of message read.
  - `message_id: str`: ID of the read message.
  - `recipient_id: str`: Recipient’s peer ID.
  - `nickname: str`: Recipient’s display name.
  - `timestamp: int`: Unix timestamp of read event.

- **OptimizedBloomFilter**: Bloom filter for efficient message tracking.
  - `expected_items: int`: Expected number of items (e.g., 100).
  - `false_positive_rate: float`: Desired false positive rate (e.g., 0.01).
  - Methods: `insert(item: str)`, `contains(item: str) -> bool`, `reset()`, `estimated_false_positive_rate() -> float`, `memory_size_bytes() -> int`, `adaptive(network_size: int) -> OptimizedBloomFilter`.

- **ChannelManager**: Manages channels and their properties.
  - `joined_channels: Set[str]`: Set of joined channel names.
  - `current_channel: str`: Active channel name.
  - `password_protected_channels: Set[str]`: Channels requiring passwords.
  - `channel_keys: Dict[str, bytes]`: Derived encryption keys for channels.
  - `channel_passwords: Dict[str, str]`: Passwords for protected channels.
  - `channel_creators: Dict[str, str]`: Creator peer IDs for channels.
  - `system_messages: List[BitchatMessage]`: System-generated messages.

### Core Methods

Below are the public methods exported by the `bitchat` module, with detailed parameter explanations and usage examples.

#### BLE Communication (bitchat.ble_service)

- **start_advertising(peer_id: str) -> None**:
  - Initiates BLE advertising to announce the device’s presence.
  - `peer_id: str`: Unique 8-byte identifier for the device (e.g., `"bitchat_peer1"`).
  - Raises `ValueError` if `peer_id` is invalid (e.g., wrong length or format).
  - **Use Case**: Start advertising to join the mesh network.

- **scan_peers() -> List[str]**:
  - Scans for nearby peers and returns their IDs.
  - Returns a list of peer IDs (e.g., `["peer1", "peer2"]`).
  - **Use Case**: Discover peers for direct messaging or channel communication.

- **send_packet(packet: BitchatPacket, peer_id: str) -> None**:
  - Sends a packet to a specific peer or broadcasts it.
  - `packet: BitchatPacket`: Packet to send (e.g., message, ACK, or receipt).
  - `peer_id: str`: Recipient’s peer ID or `"\xFF" * 8` for broadcast.
  - Raises `ValueError` for invalid `peer_id`.
  - **Use Case**: Low-level packet transmission (typically internal).

- **receive_packet() -> BitchatPacket**:
  - Receives a packet from the BLE network.
  - Returns a `BitchatPacket` or raises an exception on failure.
  - **Use Case**: Handle incoming packets in a GUI event loop.

- **send_message(message: BitchatMessage, recipient: str | None = None) -> None**:
  - Sends a message to a recipient or broadcasts to a channel.
  - `message: BitchatMessage`: Message to send.
  - `recipient: str | None`: Peer ID for private messages; `None` for channel or broadcast.
  - Raises `ValueError` for invalid `recipient` or message format.
  - **Use Case**: Send public, private, or channel messages.

- **send_encrypted_channel_message(message: BitchatMessage, channel: str) -> None**:
  - Sends an encrypted message to a password-protected channel.
  - `message: BitchatMessage`: Message with `channel` set and `content` to encrypt.
  - `channel: str`: Target channel (e.g., `"#secret"`).
  - Raises `ValueError` if channel is invalid or key derivation fails.
  - **Use Case**: Secure channel communication.

- **send_delivery_ack(ack: DeliveryAck) -> None**:
  - Sends a delivery acknowledgment to a peer.
  - `ack: DeliveryAck`: Acknowledgment to send.
  - **Use Case**: Confirm message delivery.

- **send_read_receipt(receipt: ReadReceipt) -> None**:
  - Sends a read receipt to a peer.
  - `receipt: ReadReceipt`: Receipt to send.
  - **Use Case**: Confirm message read status.

#### Protocol Encoding/Decoding (bitchat.protocol)

- **encode_packet(packet: BitchatPacket) -> bytes**:
  - Serializes a packet to bytes for BLE transmission.
  - `packet: BitchatPacket`: Packet to encode.
  - Returns serialized bytes.
  - **Use Case**: Prepare packets for low-level transmission (typically internal).

- **decode_packet(data: bytes) -> BitchatPacket**:
  - Deserializes bytes into a `BitchatPacket`.
  - `data: bytes`: Raw packet data.
  - Returns `BitchatPacket` or `None` if invalid.
  - **Use Case**: Process received packets (typically internal).

- **encode_message(message: BitchatMessage) -> bytes**:
  - Serializes a message to bytes.
  - `message: BitchatMessage`: Message to encode.
  - Returns serialized bytes.
  - **Use Case**: Prepare messages for packet payloads.

- **decode_message(data: bytes) -> BitchatMessage**:
  - Deserializes bytes into a `BitchatMessage`.
  - `data: bytes`: Raw message data.
  - Returns `BitchatMessage` or raises `ValueError` if invalid.
  - **Use Case**: Process received message payloads.

#### Message Padding (bitchat.message)

- **pad(data: bytes, target_size: int) -> bytes**:
  - Applies PKCS#7 padding with random bytes to reach `target_size`.
  - `data: bytes`: Data to pad.
  - `target_size: int`: Desired size (up to 255 bytes).
  - Returns padded bytes.
  - **Use Case**: Pad messages for consistent size in privacy-sensitive contexts.

- **unpad(data: bytes) -> bytes**:
  - Removes PKCS#7 padding.
  - `data: bytes`: Padded data.
  - Returns unpadded bytes or original data if invalid.
  - **Use Case**: Unpad received message payloads.

- **optimal_block_size(data_size: int) -> int**:
  - Selects optimal block size for padding.
  - `data_size: int`: Size of data to pad.
  - Returns size from `[256, 512, 1024, 2048]` or `data_size`.
  - **Use Case**: Determine padding size for messages.

#### Encryption (bitchat.encryption)

- **generate_signature(data: bytes, key: bytes) -> bytes**:
  - Creates a 64-byte signature for data authenticity.
  - `data: bytes`: Data to sign.
  - `key: bytes`: 32-byte signing key.
  - Returns 64-byte signature.
  - **Use Case**: Sign packets for verification.

- **verify_signature(data: bytes, signature: bytes, key: bytes) -> bool**:
  - Verifies a signature for data.
  - `data: bytes`: Original data.
  - `signature: bytes`: 64-byte signature.
  - `key: bytes`: 32-byte signing key.
  - Returns `True` if valid, `False` otherwise.
  - **Use Case**: Verify packet authenticity.

- **encrypt_content(content: str, key: bytes) -> bytes**:
  - Encrypts content using AES-GCM.
  - `content: str`: Text to encrypt.
  - `key: bytes`: 32-byte encryption key.
  - Returns encrypted bytes.
  - **Use Case**: Encrypt messages for secure channels.

- **decrypt_content(data: bytes, key: bytes) -> str**:
  - Decrypts content using AES-GCM.
  - `data: bytes`: Encrypted data.
  - `key: bytes`: 32-byte decryption key.
  - Returns decrypted text or raises `ValueError` on failure.
  - **Use Case**: Decrypt received channel messages.

- **derive_channel_key(password: str, channel: str) -> bytes**:
  - Derives a 32-byte key using PBKDF2 with SHA256 and channel as salt.
  - `password: str`: Channel password.
  - `channel: str`: Channel name (e.g., `"#secret"`).
  - Returns 32-byte key.
  - **Use Case**: Generate keys for password-protected channels.

#### Key Management (bitchat.keychain)

- **store_key(key: bytes, identifier: str) -> None**:
  - Stores an encryption key securely.
  - `key: bytes`: Key to store (e.g., 32-byte channel key).
  - `identifier: str`: Key identifier (e.g., `"channel:#secret"`).
  - **Use Case**: Save channel or peer keys.

- **retrieve_key(identifier: str) -> bytes**:
  - Retrieves a stored key.
  - `identifier: str`: Key identifier.
  - Returns key bytes or raises `KeyError` if not found.
  - **Use Case**: Access keys for encryption/decryption.

- **generate_channel_key(channel: str, password: str) -> bytes**:
  - Derives and stores a channel key.
  - `channel: str`: Channel name.
  - `password: str`: Channel password.
  - Returns 32-byte key.
  - **Use Case**: Initialize keys for new channels.

#### Channel Management (bitchat.channel)

- **ChannelManager.create_channel(channel: str, password: str | None = None, creator_id: str | None = None) -> None**:
  - Creates a new channel, optionally password-protected.
  - `channel: str`: Channel name (regex: `^#[a-zA-Z0-9-]+$`).
  - `password: str | None`: Password for protection; `None` for public.
  - `creator_id: str | None`: Peer ID of creator; defaults to current peer.
  - Raises `ValueError` for invalid channel name.
  - **Use Case**: Set up a new channel.

- **ChannelManager.join_channel(channel: str, password: str | None = None, peer_id: str | None = None) -> None**:
  - Joins a channel, handling password if required.
  - `channel: str`: Channel to join.
  - `password: str | None`: Password for protected channel.
  - `peer_id: str | None`: Peer ID; defaults to current peer.
  - Raises `ValueError` for invalid channel or wrong password.
  - **Use Case**: Join existing channels.

- **ChannelManager.set_channel_password(channel: str, password: str, peer_id: str) -> None**:
  - Sets or updates a channel’s password (creator only).
  - `channel: str`: Channel name.
  - `password: str`: New password.
  - `peer_id: str`: Peer ID of requester.
  - Raises `ValueError` if not creator or channel invalid.
  - **Use Case**: Secure an existing channel.

- **ChannelManager.remove_channel_password(channel: str, peer_id: str) -> None**:
  - Removes a channel’s password (creator only).
  - `channel: str`: Channel name.
  - `peer_id: str`: Peer ID of requester.
  - Raises `ValueError` if not creator or channel invalid.
  - **Use Case**: Make a channel public.

- **ChannelManager.receive_message(message: BitchatMessage) -> None**:
  - Processes a received message, updating channel state.
  - `message: BitchatMessage`: Received message.
  - **Use Case**: Handle incoming messages in GUI.

- **ChannelManager.process_command(command: str, peer_id: str) -> None**:
  - Processes commands like `/join #channel` or `/j #channel`.
  - `command: str`: Command string.
  - `peer_id: str`: Peer ID of requester.
  - Raises `ValueError` for invalid commands.
  - **Use Case**: Handle user commands in GUI.

- **ChannelManager.get_system_messages() -> List[BitchatMessage]**:
  - Returns system-generated messages (e.g., join notifications).
  - Returns list of `BitchatMessage`.
  - **Use Case**: Display system messages in GUI.

- **ChannelManager.transfer_ownership(channel: str, new_owner_id: str, peer_id: str) -> None**:
  - Transfers channel ownership (creator only).
  - `channel: str`: Channel name.
  - `new_owner_id: str`: New owner’s peer ID.
  - `peer_id: str`: Current peer ID.
  - Raises `ValueError` if not creator or invalid channel.
  - **Use Case**: Reassign channel administration.

#### Delivery Tracking (bitchat.delivery_tracker)

- **DeliveryTracker.track_message(message_id: str, status: str) -> None**:
  - Tracks a message’s delivery status.
  - `message_id: str`: Message ID.
  - `status: str`: Status (`"PENDING"`, `"DELIVERED"`, `"READ"`).
  - **Use Case**: Update message status in GUI.

- **DeliveryTracker.generate_ack(message_id: str, recipient_id: str, nickname: str, hop_count: int) -> DeliveryAck**:
  - Creates a delivery acknowledgment.
  - `message_id: str`: Message ID.
  - `recipient_id: str`: Recipient’s peer ID.
  - `nickname: str`: Recipient’s display name.
  - `hop_count: int`: Number of hops.
  - Returns `DeliveryAck`.
  - **Use Case**: Generate ACKs for received messages.

- **DeliveryTracker.process_ack(ack: DeliveryAck) -> None**:
  - Processes a received ACK, updating status.
  - `ack: DeliveryAck`: Acknowledgment to process.
  - **Use Case**: Update GUI with delivery confirmation.

- **DeliveryTracker.get_status(message_id: str) -> str | None**:
  - Retrieves a message’s delivery status.
  - `message_id: str`: Message ID.
  - Returns status or `None` if unknown.
  - **Use Case**: Display message status in GUI.

- **DeliveryTracker.get_acks(message_id: str) -> List[DeliveryAck]**:
  - Retrieves all ACKs for a message.
  - `message_id: str`: Message ID.
  - Returns list of `DeliveryAck`.
  - **Use Case**: Show delivery confirmations.

### Example Usage for GUI Applications

The following example demonstrates how to integrate the library into a Python GUI application (e.g., Tkinter) for public channel messaging, private messaging, encrypted channel messaging, and delivery tracking. It includes an event loop for receiving messages and handling system events.

```python
import asyncio
from uuid import uuid4
import time
from tkinter import Tk, Text, Entry, Button, END
from bitchat import (
    BitchatMessage, ChannelManager, DeliveryTracker, OptimizedBloomFilter,
    start_advertising, scan_peers, send_message, send_encrypted_channel_message,
    receive_packet, decode_packet, decode_message, generate_signature, verify_signature,
    encrypt_content, decrypt_content, derive_channel_key, store_key, retrieve_key,
    send_delivery_ack, send_read_receipt
)

# Initialize components
peer_id = "bitchat_peer1"
channel_manager = ChannelManager()
delivery_tracker = DeliveryTracker()
bloom_filter = OptimizedBloomFilter(expected_items=100, false_positive_rate=0.01)
signing_key = b"\x01" * 32
store_key(signing_key, f"peer:{peer_id}")

# Tkinter GUI setup
root = Tk()
root.title("Bitchat Messenger")
chat_display = Text(root, height=20, width=50)
chat_display.pack()
message_entry = Entry(root, width=50)
message_entry.pack()
channel_entry = Entry(root, width=20)
channel_entry.pack()
channel_entry.insert(0, "#general")

# Start BLE advertising
async def start_network():
    await start_advertising(peer_id)
    chat_display.insert(END, "Started advertising as {}\n".format(peer_id))

# Send a public or private message
def send_message_gui():
    content = message_entry.get()
    channel = channel_entry.get()
    message_id = str(uuid4())
    timestamp = int(time.time())
    
    # Create message
    message = BitchatMessage(
        id=message_id,
        sender="alice",
        content=content,
        timestamp=timestamp,
        is_relay=False,
        original_sender=None,
        is_private=False,
        recipient_nickname=None,
        sender_peer_id=peer_id,
        mentions=[],
        channel=channel,
        is_encrypted=False,
        encrypted_content=None,
        delivery_status="PENDING"
    )
    
    # Track message
    delivery_tracker.track_message(message_id, "PENDING")
    
    # Send message (public channel or broadcast)
    asyncio.run(send_message(message))
    chat_display.insert(END, f"[{channel}] alice: {content}\n")
    message_entry.delete(0, END)

# Send an encrypted channel message
def send_encrypted_message_gui():
    content = message_entry.get()
    channel = channel_entry.get()
    password = "secure123"  # Replace with GUI input
    message_id = str(uuid4())
    timestamp = int(time.time())
    
    # Derive and store channel key
    key = derive_channel_key(password, channel)
    store_key(key, f"channel:{channel}")
    
    # Encrypt content
    encrypted_content = encrypt_content(content, key)
    
    # Create encrypted message
    message = BitchatMessage(
        id=message_id,
        sender="alice",
        content="",
        timestamp=timestamp,
        is_relay=False,
        original_sender=None,
        is_private=False,
        recipient_nickname=None,
        sender_peer_id=peer_id,
        mentions=[],
        channel=channel,
        is_encrypted=True,
        encrypted_content=encrypted_content,
        delivery_status="PENDING"
    )
    
    # Track and send message
    delivery_tracker.track_message(message_id, "PENDING")
    asyncio.run(send_encrypted_channel_message(message, channel))
    chat_display.insert(END, f"[{channel}] alice: [Encrypted]\n")
    message_entry.delete(0, END)

# Join a channel (public or password-protected)
def join_channel_gui():
    channel = channel_entry.get()
    password = None  # Replace with GUI input for password
    try:
        channel_manager.join_channel(channel, password, peer_id)
        chat_display.insert(END, f"Joined channel {channel}\n")
    except ValueError as e:
        chat_display.insert(END, f"Error joining {channel}: {e}\n")

# Async event loop for receiving messages
async def receive_messages():
    while True:
        try:
            packet = await receive_packet()
            if verify_signature(packet.payload, packet.signature, signing_key):
                message = decode_message(packet.payload)
                
                # Handle delivery ACK
                delivery_tracker.process_ack(DeliveryAck(
                    message_id=message.id,
                    recipient_id=peer_id,
                    nickname="alice",
                    hop_count=1
                ))
                asyncio.run(send_delivery_ack(DeliveryAck(
                    message_id=message.id,
                    recipient_id=packet.sender_id,
                    nickname="alice",
                    hop_count=1
                )))
                
                # Handle read receipt
                delivery_tracker.track_message(message.id, "READ")
                asyncio.run(send_read_receipt(ReadReceipt(
                    message_id=message.id,
                    recipient_id=peer_id,
                    nickname="alice",
                    timestamp=int(time.time())
                )))
                
                # Process message
                channel_manager.receive_message(message)
                
                # Decrypt if needed
                if message.is_encrypted:
                    key = retrieve_key(f"channel:{message.channel}")
                    content = decrypt_content(message.encrypted_content, key)
                else:
                    content = message.content
                
                chat_display.insert(END, f"[{message.channel}] {message.sender}: {content}\n")
                
                # Update bloom filter for message tracking
                bloom_filter.insert(message.id)
                
                # Display system messages
                for sys_msg in channel_manager.get_system_messages():
                    chat_display.insert(END, f"[System] {sys_msg.content}\n")
        except Exception as e:
            chat_display.insert(END, f"Error receiving message: {e}\n")
        await asyncio.sleep(0.1)

# GUI buttons
send_button = Button(root, text="Send Message", command=send_message_gui)
send_button.pack()
send_encrypted_button = Button(root, text="Send Encrypted", command=send_encrypted_message_gui)
send_encrypted_button.pack()
join_button = Button(root, text="Join Channel", command=join_channel_gui)
join_button.pack()

# Run event loop
loop = asyncio.get_event_loop()
loop.create_task(start_network())
loop.create_task(receive_messages())
root.mainloop()
```

### Notes for GUI Developers
- **Asynchronous Operations**: Methods like `start_advertising`, `send_message`, `send_encrypted_channel_message`, `send_delivery_ack`, `send_read_receipt`, and `receive_packet` are asynchronous due to BLE operations (using `bleak`). Use `asyncio.run()` for one-off calls or integrate with an event loop (as shown).
- **Error Handling**: Wrap calls in try-except blocks to handle `ValueError` (e.g., invalid peer IDs, channel names, or decryption failures) and display errors in the GUI.
- **Real-Time Updates**: Use `receive_packet` in an async loop to update the GUI with incoming messages, ACKs, and system messages.
- **Thread Safety**: Ensure Tkinter updates (e.g., `chat_display.insert`) are thread-safe by using `root.after` or a similar mechanism if running async tasks.
- **Channel Management**: Use `ChannelManager` to track joined channels and handle password-protected channels. Validate channel names with regex (`^#[a-zA-Z0-9-]+$`).
- **Privacy**: Use `pad` and `unpad` for consistent message sizes, and `OptimizedBloomFilter` to track seen messages efficiently.
- **Security**: Always verify signatures with `verify_signature` before processing packets, and store keys securely with `store_key`.

For further details, refer to the [API documentation](https://bitchat-py.readthedocs.io/) and the [Bitchat Whitepaper](https://github.com/jackjackbits/bitchat/blob/main/WHITEPAPER.md).

## Testing

Run unit tests to verify functionality:

<code>pytest tests/</code>

Generate coverage report:

<code>pytest tests/ --cov --cov-report=html</code>

## Contributing

Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/nguyentruonglong/bitchat-py).

## License

This project is released under the [Unlicense](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bitchat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": "bitchat, mesh-networking, ble, encryption",
    "author": "Nguyen Truong Long",
    "author_email": "nguyentruonglongdev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/57/9dc22160b47c204b61f224a6fb8ec2c5f8a4240669aa046bdb550995bc6a/bitchat-1.0.0.tar.gz",
    "platform": null,
    "description": "# Bitchat Python Library\n\nA secure, decentralized mesh networking library implementing the Bitchat protocol, as described in [Jack Dorsey\u2019s Bitchat Whitepaper](https://github.com/jackjackbits/bitchat/blob/main/WHITEPAPER.md). It supports Bluetooth Low Energy (BLE) communication, message encryption, delivery tracking, channel management, and password-protected channels for privacy-preserving, peer-to-peer messaging.\n\n<img src=\"https://badge.fury.io/py/bitchat.svg\" alt=\"PyPI Version\">\n<img src=\"https://readthedocs.org/projects/bitchat-py/badge/?version=latest\" alt=\"Documentation\">\n\n## Installation\n\nInstall the library using pip:\n\n<code>pip3 install bitchat</code>\n\n## Usage\n\nThe Bitchat Python Library provides a robust set of tools for building decentralized, secure messaging applications with BLE-based mesh networking. Below are comprehensive examples and parameter explanations for all public methods and classes, designed to guide Python GUI developers (e.g., using Tkinter, PyQt, or Kivy) in integrating the library. The examples avoid redundancy by covering distinct use cases: public channel messaging, private messaging, encrypted channel messaging, and delivery tracking.\n\n### Key Classes and Structures\n\nThe library exports the following classes from the `bitchat` module, used to construct and manage messages, packets, and channels:\n\n- **BitchatPacket**: Represents a network packet for BLE transmission.\n  - `version: int`: Protocol version (must be 1).\n  - `type: str`: Packet type (`\"message\"`, `\"ack\"`, `\"receipt\"`).\n  - `sender_id: str`: 8-byte unique sender identifier (e.g., `\"peer123\"`).\n  - `recipient_id: str`: 8-byte recipient identifier or `\"\\xFF\" * 8` for broadcast.\n  - `timestamp: int`: Unix timestamp (seconds).\n  - `payload: bytes`: Encoded message, ACK, or receipt.\n  - `signature: bytes`: 64-byte signature for authenticity.\n  - `ttl: int`: Time-to-live (hops, e.g., 5).\n\n- **BitchatMessage**: Represents a message in the Bitchat protocol.\n  - `id: str`: Unique message ID (e.g., UUID from `uuid4()`).\n  - `sender: str`: Sender\u2019s display name (e.g., `\"alice\"`).\n  - `content: str`: Message text (empty for encrypted messages).\n  - `timestamp: int`: Unix timestamp (seconds).\n  - `is_relay: bool`: True if message is relayed by another peer.\n  - `original_sender: str | None`: Original sender\u2019s name for relayed messages.\n  - `is_private: bool`: True for private messages to a specific recipient.\n  - `recipient_nickname: str | None`: Recipient\u2019s display name for private messages.\n  - `sender_peer_id: str`: Sender\u2019s unique peer ID (e.g., `\"bitchat_peer1\"`).\n  - `mentions: List[str]`: List of mentioned user names (e.g., `[\"bob\", \"charlie\"]`).\n  - `channel: str | None`: Channel name (e.g., `\"#general\"`, regex: `^#[a-zA-Z0-9-]+$`).\n  - `encrypted_content: bytes | None`: Encrypted message content for secure channels.\n  - `is_encrypted: bool`: True if message uses `encrypted_content`.\n  - `delivery_status: str`: Status (`\"PENDING\"`, `\"DELIVERED\"`, `\"READ\"`).\n\n- **DeliveryAck**: Acknowledgment of message delivery.\n  - `message_id: str`: ID of the acknowledged message.\n  - `recipient_id: str`: Recipient\u2019s peer ID.\n  - `nickname: str`: Recipient\u2019s display name.\n  - `hop_count: int`: Number of hops the message traveled.\n\n- **ReadReceipt**: Confirmation of message read.\n  - `message_id: str`: ID of the read message.\n  - `recipient_id: str`: Recipient\u2019s peer ID.\n  - `nickname: str`: Recipient\u2019s display name.\n  - `timestamp: int`: Unix timestamp of read event.\n\n- **OptimizedBloomFilter**: Bloom filter for efficient message tracking.\n  - `expected_items: int`: Expected number of items (e.g., 100).\n  - `false_positive_rate: float`: Desired false positive rate (e.g., 0.01).\n  - Methods: `insert(item: str)`, `contains(item: str) -> bool`, `reset()`, `estimated_false_positive_rate() -> float`, `memory_size_bytes() -> int`, `adaptive(network_size: int) -> OptimizedBloomFilter`.\n\n- **ChannelManager**: Manages channels and their properties.\n  - `joined_channels: Set[str]`: Set of joined channel names.\n  - `current_channel: str`: Active channel name.\n  - `password_protected_channels: Set[str]`: Channels requiring passwords.\n  - `channel_keys: Dict[str, bytes]`: Derived encryption keys for channels.\n  - `channel_passwords: Dict[str, str]`: Passwords for protected channels.\n  - `channel_creators: Dict[str, str]`: Creator peer IDs for channels.\n  - `system_messages: List[BitchatMessage]`: System-generated messages.\n\n### Core Methods\n\nBelow are the public methods exported by the `bitchat` module, with detailed parameter explanations and usage examples.\n\n#### BLE Communication (bitchat.ble_service)\n\n- **start_advertising(peer_id: str) -> None**:\n  - Initiates BLE advertising to announce the device\u2019s presence.\n  - `peer_id: str`: Unique 8-byte identifier for the device (e.g., `\"bitchat_peer1\"`).\n  - Raises `ValueError` if `peer_id` is invalid (e.g., wrong length or format).\n  - **Use Case**: Start advertising to join the mesh network.\n\n- **scan_peers() -> List[str]**:\n  - Scans for nearby peers and returns their IDs.\n  - Returns a list of peer IDs (e.g., `[\"peer1\", \"peer2\"]`).\n  - **Use Case**: Discover peers for direct messaging or channel communication.\n\n- **send_packet(packet: BitchatPacket, peer_id: str) -> None**:\n  - Sends a packet to a specific peer or broadcasts it.\n  - `packet: BitchatPacket`: Packet to send (e.g., message, ACK, or receipt).\n  - `peer_id: str`: Recipient\u2019s peer ID or `\"\\xFF\" * 8` for broadcast.\n  - Raises `ValueError` for invalid `peer_id`.\n  - **Use Case**: Low-level packet transmission (typically internal).\n\n- **receive_packet() -> BitchatPacket**:\n  - Receives a packet from the BLE network.\n  - Returns a `BitchatPacket` or raises an exception on failure.\n  - **Use Case**: Handle incoming packets in a GUI event loop.\n\n- **send_message(message: BitchatMessage, recipient: str | None = None) -> None**:\n  - Sends a message to a recipient or broadcasts to a channel.\n  - `message: BitchatMessage`: Message to send.\n  - `recipient: str | None`: Peer ID for private messages; `None` for channel or broadcast.\n  - Raises `ValueError` for invalid `recipient` or message format.\n  - **Use Case**: Send public, private, or channel messages.\n\n- **send_encrypted_channel_message(message: BitchatMessage, channel: str) -> None**:\n  - Sends an encrypted message to a password-protected channel.\n  - `message: BitchatMessage`: Message with `channel` set and `content` to encrypt.\n  - `channel: str`: Target channel (e.g., `\"#secret\"`).\n  - Raises `ValueError` if channel is invalid or key derivation fails.\n  - **Use Case**: Secure channel communication.\n\n- **send_delivery_ack(ack: DeliveryAck) -> None**:\n  - Sends a delivery acknowledgment to a peer.\n  - `ack: DeliveryAck`: Acknowledgment to send.\n  - **Use Case**: Confirm message delivery.\n\n- **send_read_receipt(receipt: ReadReceipt) -> None**:\n  - Sends a read receipt to a peer.\n  - `receipt: ReadReceipt`: Receipt to send.\n  - **Use Case**: Confirm message read status.\n\n#### Protocol Encoding/Decoding (bitchat.protocol)\n\n- **encode_packet(packet: BitchatPacket) -> bytes**:\n  - Serializes a packet to bytes for BLE transmission.\n  - `packet: BitchatPacket`: Packet to encode.\n  - Returns serialized bytes.\n  - **Use Case**: Prepare packets for low-level transmission (typically internal).\n\n- **decode_packet(data: bytes) -> BitchatPacket**:\n  - Deserializes bytes into a `BitchatPacket`.\n  - `data: bytes`: Raw packet data.\n  - Returns `BitchatPacket` or `None` if invalid.\n  - **Use Case**: Process received packets (typically internal).\n\n- **encode_message(message: BitchatMessage) -> bytes**:\n  - Serializes a message to bytes.\n  - `message: BitchatMessage`: Message to encode.\n  - Returns serialized bytes.\n  - **Use Case**: Prepare messages for packet payloads.\n\n- **decode_message(data: bytes) -> BitchatMessage**:\n  - Deserializes bytes into a `BitchatMessage`.\n  - `data: bytes`: Raw message data.\n  - Returns `BitchatMessage` or raises `ValueError` if invalid.\n  - **Use Case**: Process received message payloads.\n\n#### Message Padding (bitchat.message)\n\n- **pad(data: bytes, target_size: int) -> bytes**:\n  - Applies PKCS#7 padding with random bytes to reach `target_size`.\n  - `data: bytes`: Data to pad.\n  - `target_size: int`: Desired size (up to 255 bytes).\n  - Returns padded bytes.\n  - **Use Case**: Pad messages for consistent size in privacy-sensitive contexts.\n\n- **unpad(data: bytes) -> bytes**:\n  - Removes PKCS#7 padding.\n  - `data: bytes`: Padded data.\n  - Returns unpadded bytes or original data if invalid.\n  - **Use Case**: Unpad received message payloads.\n\n- **optimal_block_size(data_size: int) -> int**:\n  - Selects optimal block size for padding.\n  - `data_size: int`: Size of data to pad.\n  - Returns size from `[256, 512, 1024, 2048]` or `data_size`.\n  - **Use Case**: Determine padding size for messages.\n\n#### Encryption (bitchat.encryption)\n\n- **generate_signature(data: bytes, key: bytes) -> bytes**:\n  - Creates a 64-byte signature for data authenticity.\n  - `data: bytes`: Data to sign.\n  - `key: bytes`: 32-byte signing key.\n  - Returns 64-byte signature.\n  - **Use Case**: Sign packets for verification.\n\n- **verify_signature(data: bytes, signature: bytes, key: bytes) -> bool**:\n  - Verifies a signature for data.\n  - `data: bytes`: Original data.\n  - `signature: bytes`: 64-byte signature.\n  - `key: bytes`: 32-byte signing key.\n  - Returns `True` if valid, `False` otherwise.\n  - **Use Case**: Verify packet authenticity.\n\n- **encrypt_content(content: str, key: bytes) -> bytes**:\n  - Encrypts content using AES-GCM.\n  - `content: str`: Text to encrypt.\n  - `key: bytes`: 32-byte encryption key.\n  - Returns encrypted bytes.\n  - **Use Case**: Encrypt messages for secure channels.\n\n- **decrypt_content(data: bytes, key: bytes) -> str**:\n  - Decrypts content using AES-GCM.\n  - `data: bytes`: Encrypted data.\n  - `key: bytes`: 32-byte decryption key.\n  - Returns decrypted text or raises `ValueError` on failure.\n  - **Use Case**: Decrypt received channel messages.\n\n- **derive_channel_key(password: str, channel: str) -> bytes**:\n  - Derives a 32-byte key using PBKDF2 with SHA256 and channel as salt.\n  - `password: str`: Channel password.\n  - `channel: str`: Channel name (e.g., `\"#secret\"`).\n  - Returns 32-byte key.\n  - **Use Case**: Generate keys for password-protected channels.\n\n#### Key Management (bitchat.keychain)\n\n- **store_key(key: bytes, identifier: str) -> None**:\n  - Stores an encryption key securely.\n  - `key: bytes`: Key to store (e.g., 32-byte channel key).\n  - `identifier: str`: Key identifier (e.g., `\"channel:#secret\"`).\n  - **Use Case**: Save channel or peer keys.\n\n- **retrieve_key(identifier: str) -> bytes**:\n  - Retrieves a stored key.\n  - `identifier: str`: Key identifier.\n  - Returns key bytes or raises `KeyError` if not found.\n  - **Use Case**: Access keys for encryption/decryption.\n\n- **generate_channel_key(channel: str, password: str) -> bytes**:\n  - Derives and stores a channel key.\n  - `channel: str`: Channel name.\n  - `password: str`: Channel password.\n  - Returns 32-byte key.\n  - **Use Case**: Initialize keys for new channels.\n\n#### Channel Management (bitchat.channel)\n\n- **ChannelManager.create_channel(channel: str, password: str | None = None, creator_id: str | None = None) -> None**:\n  - Creates a new channel, optionally password-protected.\n  - `channel: str`: Channel name (regex: `^#[a-zA-Z0-9-]+$`).\n  - `password: str | None`: Password for protection; `None` for public.\n  - `creator_id: str | None`: Peer ID of creator; defaults to current peer.\n  - Raises `ValueError` for invalid channel name.\n  - **Use Case**: Set up a new channel.\n\n- **ChannelManager.join_channel(channel: str, password: str | None = None, peer_id: str | None = None) -> None**:\n  - Joins a channel, handling password if required.\n  - `channel: str`: Channel to join.\n  - `password: str | None`: Password for protected channel.\n  - `peer_id: str | None`: Peer ID; defaults to current peer.\n  - Raises `ValueError` for invalid channel or wrong password.\n  - **Use Case**: Join existing channels.\n\n- **ChannelManager.set_channel_password(channel: str, password: str, peer_id: str) -> None**:\n  - Sets or updates a channel\u2019s password (creator only).\n  - `channel: str`: Channel name.\n  - `password: str`: New password.\n  - `peer_id: str`: Peer ID of requester.\n  - Raises `ValueError` if not creator or channel invalid.\n  - **Use Case**: Secure an existing channel.\n\n- **ChannelManager.remove_channel_password(channel: str, peer_id: str) -> None**:\n  - Removes a channel\u2019s password (creator only).\n  - `channel: str`: Channel name.\n  - `peer_id: str`: Peer ID of requester.\n  - Raises `ValueError` if not creator or channel invalid.\n  - **Use Case**: Make a channel public.\n\n- **ChannelManager.receive_message(message: BitchatMessage) -> None**:\n  - Processes a received message, updating channel state.\n  - `message: BitchatMessage`: Received message.\n  - **Use Case**: Handle incoming messages in GUI.\n\n- **ChannelManager.process_command(command: str, peer_id: str) -> None**:\n  - Processes commands like `/join #channel` or `/j #channel`.\n  - `command: str`: Command string.\n  - `peer_id: str`: Peer ID of requester.\n  - Raises `ValueError` for invalid commands.\n  - **Use Case**: Handle user commands in GUI.\n\n- **ChannelManager.get_system_messages() -> List[BitchatMessage]**:\n  - Returns system-generated messages (e.g., join notifications).\n  - Returns list of `BitchatMessage`.\n  - **Use Case**: Display system messages in GUI.\n\n- **ChannelManager.transfer_ownership(channel: str, new_owner_id: str, peer_id: str) -> None**:\n  - Transfers channel ownership (creator only).\n  - `channel: str`: Channel name.\n  - `new_owner_id: str`: New owner\u2019s peer ID.\n  - `peer_id: str`: Current peer ID.\n  - Raises `ValueError` if not creator or invalid channel.\n  - **Use Case**: Reassign channel administration.\n\n#### Delivery Tracking (bitchat.delivery_tracker)\n\n- **DeliveryTracker.track_message(message_id: str, status: str) -> None**:\n  - Tracks a message\u2019s delivery status.\n  - `message_id: str`: Message ID.\n  - `status: str`: Status (`\"PENDING\"`, `\"DELIVERED\"`, `\"READ\"`).\n  - **Use Case**: Update message status in GUI.\n\n- **DeliveryTracker.generate_ack(message_id: str, recipient_id: str, nickname: str, hop_count: int) -> DeliveryAck**:\n  - Creates a delivery acknowledgment.\n  - `message_id: str`: Message ID.\n  - `recipient_id: str`: Recipient\u2019s peer ID.\n  - `nickname: str`: Recipient\u2019s display name.\n  - `hop_count: int`: Number of hops.\n  - Returns `DeliveryAck`.\n  - **Use Case**: Generate ACKs for received messages.\n\n- **DeliveryTracker.process_ack(ack: DeliveryAck) -> None**:\n  - Processes a received ACK, updating status.\n  - `ack: DeliveryAck`: Acknowledgment to process.\n  - **Use Case**: Update GUI with delivery confirmation.\n\n- **DeliveryTracker.get_status(message_id: str) -> str | None**:\n  - Retrieves a message\u2019s delivery status.\n  - `message_id: str`: Message ID.\n  - Returns status or `None` if unknown.\n  - **Use Case**: Display message status in GUI.\n\n- **DeliveryTracker.get_acks(message_id: str) -> List[DeliveryAck]**:\n  - Retrieves all ACKs for a message.\n  - `message_id: str`: Message ID.\n  - Returns list of `DeliveryAck`.\n  - **Use Case**: Show delivery confirmations.\n\n### Example Usage for GUI Applications\n\nThe following example demonstrates how to integrate the library into a Python GUI application (e.g., Tkinter) for public channel messaging, private messaging, encrypted channel messaging, and delivery tracking. It includes an event loop for receiving messages and handling system events.\n\n```python\nimport asyncio\nfrom uuid import uuid4\nimport time\nfrom tkinter import Tk, Text, Entry, Button, END\nfrom bitchat import (\n    BitchatMessage, ChannelManager, DeliveryTracker, OptimizedBloomFilter,\n    start_advertising, scan_peers, send_message, send_encrypted_channel_message,\n    receive_packet, decode_packet, decode_message, generate_signature, verify_signature,\n    encrypt_content, decrypt_content, derive_channel_key, store_key, retrieve_key,\n    send_delivery_ack, send_read_receipt\n)\n\n# Initialize components\npeer_id = \"bitchat_peer1\"\nchannel_manager = ChannelManager()\ndelivery_tracker = DeliveryTracker()\nbloom_filter = OptimizedBloomFilter(expected_items=100, false_positive_rate=0.01)\nsigning_key = b\"\\x01\" * 32\nstore_key(signing_key, f\"peer:{peer_id}\")\n\n# Tkinter GUI setup\nroot = Tk()\nroot.title(\"Bitchat Messenger\")\nchat_display = Text(root, height=20, width=50)\nchat_display.pack()\nmessage_entry = Entry(root, width=50)\nmessage_entry.pack()\nchannel_entry = Entry(root, width=20)\nchannel_entry.pack()\nchannel_entry.insert(0, \"#general\")\n\n# Start BLE advertising\nasync def start_network():\n    await start_advertising(peer_id)\n    chat_display.insert(END, \"Started advertising as {}\\n\".format(peer_id))\n\n# Send a public or private message\ndef send_message_gui():\n    content = message_entry.get()\n    channel = channel_entry.get()\n    message_id = str(uuid4())\n    timestamp = int(time.time())\n    \n    # Create message\n    message = BitchatMessage(\n        id=message_id,\n        sender=\"alice\",\n        content=content,\n        timestamp=timestamp,\n        is_relay=False,\n        original_sender=None,\n        is_private=False,\n        recipient_nickname=None,\n        sender_peer_id=peer_id,\n        mentions=[],\n        channel=channel,\n        is_encrypted=False,\n        encrypted_content=None,\n        delivery_status=\"PENDING\"\n    )\n    \n    # Track message\n    delivery_tracker.track_message(message_id, \"PENDING\")\n    \n    # Send message (public channel or broadcast)\n    asyncio.run(send_message(message))\n    chat_display.insert(END, f\"[{channel}] alice: {content}\\n\")\n    message_entry.delete(0, END)\n\n# Send an encrypted channel message\ndef send_encrypted_message_gui():\n    content = message_entry.get()\n    channel = channel_entry.get()\n    password = \"secure123\"  # Replace with GUI input\n    message_id = str(uuid4())\n    timestamp = int(time.time())\n    \n    # Derive and store channel key\n    key = derive_channel_key(password, channel)\n    store_key(key, f\"channel:{channel}\")\n    \n    # Encrypt content\n    encrypted_content = encrypt_content(content, key)\n    \n    # Create encrypted message\n    message = BitchatMessage(\n        id=message_id,\n        sender=\"alice\",\n        content=\"\",\n        timestamp=timestamp,\n        is_relay=False,\n        original_sender=None,\n        is_private=False,\n        recipient_nickname=None,\n        sender_peer_id=peer_id,\n        mentions=[],\n        channel=channel,\n        is_encrypted=True,\n        encrypted_content=encrypted_content,\n        delivery_status=\"PENDING\"\n    )\n    \n    # Track and send message\n    delivery_tracker.track_message(message_id, \"PENDING\")\n    asyncio.run(send_encrypted_channel_message(message, channel))\n    chat_display.insert(END, f\"[{channel}] alice: [Encrypted]\\n\")\n    message_entry.delete(0, END)\n\n# Join a channel (public or password-protected)\ndef join_channel_gui():\n    channel = channel_entry.get()\n    password = None  # Replace with GUI input for password\n    try:\n        channel_manager.join_channel(channel, password, peer_id)\n        chat_display.insert(END, f\"Joined channel {channel}\\n\")\n    except ValueError as e:\n        chat_display.insert(END, f\"Error joining {channel}: {e}\\n\")\n\n# Async event loop for receiving messages\nasync def receive_messages():\n    while True:\n        try:\n            packet = await receive_packet()\n            if verify_signature(packet.payload, packet.signature, signing_key):\n                message = decode_message(packet.payload)\n                \n                # Handle delivery ACK\n                delivery_tracker.process_ack(DeliveryAck(\n                    message_id=message.id,\n                    recipient_id=peer_id,\n                    nickname=\"alice\",\n                    hop_count=1\n                ))\n                asyncio.run(send_delivery_ack(DeliveryAck(\n                    message_id=message.id,\n                    recipient_id=packet.sender_id,\n                    nickname=\"alice\",\n                    hop_count=1\n                )))\n                \n                # Handle read receipt\n                delivery_tracker.track_message(message.id, \"READ\")\n                asyncio.run(send_read_receipt(ReadReceipt(\n                    message_id=message.id,\n                    recipient_id=peer_id,\n                    nickname=\"alice\",\n                    timestamp=int(time.time())\n                )))\n                \n                # Process message\n                channel_manager.receive_message(message)\n                \n                # Decrypt if needed\n                if message.is_encrypted:\n                    key = retrieve_key(f\"channel:{message.channel}\")\n                    content = decrypt_content(message.encrypted_content, key)\n                else:\n                    content = message.content\n                \n                chat_display.insert(END, f\"[{message.channel}] {message.sender}: {content}\\n\")\n                \n                # Update bloom filter for message tracking\n                bloom_filter.insert(message.id)\n                \n                # Display system messages\n                for sys_msg in channel_manager.get_system_messages():\n                    chat_display.insert(END, f\"[System] {sys_msg.content}\\n\")\n        except Exception as e:\n            chat_display.insert(END, f\"Error receiving message: {e}\\n\")\n        await asyncio.sleep(0.1)\n\n# GUI buttons\nsend_button = Button(root, text=\"Send Message\", command=send_message_gui)\nsend_button.pack()\nsend_encrypted_button = Button(root, text=\"Send Encrypted\", command=send_encrypted_message_gui)\nsend_encrypted_button.pack()\njoin_button = Button(root, text=\"Join Channel\", command=join_channel_gui)\njoin_button.pack()\n\n# Run event loop\nloop = asyncio.get_event_loop()\nloop.create_task(start_network())\nloop.create_task(receive_messages())\nroot.mainloop()\n```\n\n### Notes for GUI Developers\n- **Asynchronous Operations**: Methods like `start_advertising`, `send_message`, `send_encrypted_channel_message`, `send_delivery_ack`, `send_read_receipt`, and `receive_packet` are asynchronous due to BLE operations (using `bleak`). Use `asyncio.run()` for one-off calls or integrate with an event loop (as shown).\n- **Error Handling**: Wrap calls in try-except blocks to handle `ValueError` (e.g., invalid peer IDs, channel names, or decryption failures) and display errors in the GUI.\n- **Real-Time Updates**: Use `receive_packet` in an async loop to update the GUI with incoming messages, ACKs, and system messages.\n- **Thread Safety**: Ensure Tkinter updates (e.g., `chat_display.insert`) are thread-safe by using `root.after` or a similar mechanism if running async tasks.\n- **Channel Management**: Use `ChannelManager` to track joined channels and handle password-protected channels. Validate channel names with regex (`^#[a-zA-Z0-9-]+$`).\n- **Privacy**: Use `pad` and `unpad` for consistent message sizes, and `OptimizedBloomFilter` to track seen messages efficiently.\n- **Security**: Always verify signatures with `verify_signature` before processing packets, and store keys securely with `store_key`.\n\nFor further details, refer to the [API documentation](https://bitchat-py.readthedocs.io/) and the [Bitchat Whitepaper](https://github.com/jackjackbits/bitchat/blob/main/WHITEPAPER.md).\n\n## Testing\n\nRun unit tests to verify functionality:\n\n<code>pytest tests/</code>\n\nGenerate coverage report:\n\n<code>pytest tests/ --cov --cov-report=html</code>\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/nguyentruonglong/bitchat-py).\n\n## License\n\nThis project is released under the [Unlicense](LICENSE).\n",
    "bugtrack_url": null,
    "license": "Unlicense",
    "summary": "Python implementation of the bitchat mesh networking protocol",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/nguyentruonglong/bitchat-py",
        "Repository": "https://github.com/nguyentruonglong/bitchat-py"
    },
    "split_keywords": [
        "bitchat",
        " mesh-networking",
        " ble",
        " encryption"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "30b6e42030e84e36c38e70d7988e163b6aa6a0d6af66e8a365d6f51933e107c0",
                "md5": "9fd779656a02349f72fc92f1e847139b",
                "sha256": "cbd77401c2507feaa253055f6cc84129ff7df9952af71966d501ed559de5ebcc"
            },
            "downloads": -1,
            "filename": "bitchat-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9fd779656a02349f72fc92f1e847139b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 23071,
            "upload_time": "2025-07-09T16:20:34",
            "upload_time_iso_8601": "2025-07-09T16:20:34.804116Z",
            "url": "https://files.pythonhosted.org/packages/30/b6/e42030e84e36c38e70d7988e163b6aa6a0d6af66e8a365d6f51933e107c0/bitchat-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "62579dc22160b47c204b61f224a6fb8ec2c5f8a4240669aa046bdb550995bc6a",
                "md5": "6e87d389d53a54e225b91704533b1864",
                "sha256": "21f35423770601cfec9d73b0d0305decd490b9ee98b5087ec513adb827a3a812"
            },
            "downloads": -1,
            "filename": "bitchat-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6e87d389d53a54e225b91704533b1864",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 24427,
            "upload_time": "2025-07-09T16:20:36",
            "upload_time_iso_8601": "2025-07-09T16:20:36.948042Z",
            "url": "https://files.pythonhosted.org/packages/62/57/9dc22160b47c204b61f224a6fb8ec2c5f8a4240669aa046bdb550995bc6a/bitchat-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-09 16:20:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nguyentruonglong",
    "github_project": "bitchat-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bitchat"
}
        
Elapsed time: 1.21250s