Skip to main content

pypeer Logo

A Python Terminal-based P2P Messaging Application.

pypeer is a lightweight TUI application that enables direct, encrypted communication between peers. It leverages WebRTC for decentralized data transfer and Firebase RTDB as an ephemeral signaling server.

Python Version License Technology

Start Screen
pypeer home
Host Setup
pypeer host
Join Room
pypeer join
Messaging Screen
pypeer messaging

Installation & Usage

● ● ●
$ pip install pypeer

After installation launch the application by simply typing:

● ● ●
$ pypeer

How to use:

  1. Host a Room: Click "Host", set a password, and share the generated 6-character Room ID.
  2. Join a Room: Click "Join", enter the Room ID and the password.
  3. Chat: Once connected, start messaging.

How it Works

  1. Encrypted Signaling: Before a direct connection is established, peers must exchange handshake metadata (SDP and ICE candidates). pypeer uses Firebase RTDB as an ephemeral signaling server that acts as a temporary bulletin board.

    • Key Derivation: A 32-byte key is derived using SHA-256 from a combination of the Room ID and the User Password.
    • Layered Security: The connection metadata is cryptographically unreadable to anyone even the data provider that do not have the specific Room ID and Password.
      • Compression: Raw SDP strings are compressed using zlib to reduce payload size and obfuscate data structure.
      • Encryption: Compressed data is encrypted via AES-128 (Fernet),ensuring that only the intended peer can decrypt the handshake.
  2. The WebRTC Handshake: Once the encrypted metadata is exchanged, the terminals move from "talking to the cloud" to "talking to each other":

    • Firewall Navigation: The app uses Google's STUN servers to navigate through home routers and firewalls and determine the best route between peers.
    • Encrypted DataChannel: A dedicated tunnel is established between peers. Unlike traditional TCP sockets, SCTP over WebRTC provides native encryption, reliability, and ordered delivery without the need for a central server.
  3. Secure Direct Messaging: Once connected, the chat enters a serverless state:

    • Zero-Trace Handshake: The signaling data on Firebase RTDB is deleted. The peers remain connected directly, ensuring that no trace of the handshake remains on the cloud.
    • P2P Memory-to-Memory: Messages are sent directly between terminal memories. No history is stored on any server, and no middleman can intercept the traffic once the P2P tunnel is established.
    • Volatile Sessions: Your messages exist only as long as your terminal window is open. Once you quit, the session is wiped from your RAM.
  4. Automated Cleanup: To maintain a a clean and secure signaling bridge, pypeer employs a two-tier cleanup strategy:

    • Host-Led Deletion: Under normal conditions, the host cleans up the signaling metadata as soon as the handshake is complete.
    • GitHub Action Janitor: As a failsafe, a scheduled GitHub Action acts as a "Janitor," running every hour to automatically purge any stale or abandoned rooms left behind by interrupted connections.

Tech Stack

Core Components Implementation Purpose
TUI Engine Textual Powers the modern, responsive terminal interface.
P2P Protocol aiortc Handles WebRTC stack, ICE gathering, and DataChannels.
Signaling Firebase RTDB Used as a temporary, real-time bridge for handshakes.
Encryption Fernet (AES) Encrypts signaling payloads so metadata never leaks.
Async Core asyncio Manages concurrent networking and UI updates.

License

This project is licensed under the MIT License.

Metadata

Release files for pypeer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypeer 0.1.0
File Size Uploaded Provenance Actions
pypeer-0.1.0.tar.gz 16.7 kB Without provenance Details for pypeer-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypeer 0.1.0
File Interpreter ABI Platform Actions
pypeer-0.1.0-py3-none-any.whl Python 3 none any Details for pypeer-0.1.0-py3-none-any.whl

Total release size: 31.7 kB

Release files / pypeer-0.1.0.tar.gz

Download URL pypeer-0.1.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
426bfdf3377b8f0659e81241c0b29bef62e13e306d6058410c984bb9c33d73e4
BLAKE2b-256 checksum
How to use checksums
cd9216dee343cfc98f82d53df8576981b87dfe52ba3d8ec17195142e0187fdce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / pypeer-0.1.0-py3-none-any.whl

Download URL pypeer-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ea771c6753ae4f488c6f39b535a0c3aea7e4c55dcbdb89f1d19a9aed6cb4eb9
BLAKE2b-256 checksum
How to use checksums
3bd924473ebba1c49970c46ebc24633a3cbe518eec3b19bca2558871ec3798f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for pypeer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page