Skip to content

ForgivenID/ironwire

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 IronWire

A minimal, secure, and extensible real-time messaging server written in Rust, designed as the foundation for a full-featured messenger with voice/video messages, file sharing, and WebRTC calls.

Built with performance, correctness, and modularity in mind — leveraging axum, tokio, and modern async Rust.

Status: ✅ MVP core complete — authentication, text messaging, and file uploads working.


✨ Features (Current)

  • WebSocket-based real-time communication
  • Authentication via token (JWT-ready)
  • Peer-to-peer text messaging (online users only)
  • File upload endpoint (POST /upload) with unique URLs
  • Modular architecture (easy to extend)
  • No external database required for MVP (state kept in memory)

Video/audio "circle" messages and WebRTC calls are not yet implemented (planned).


🚀 Quick Start

Prerequisites

  • Rust (1.70+)
  • cargo
  • (Optional) websocat for CLI testing

Run the Server

git clone https://github.com/zornfeuer/ironwire
cd ironwire
cargo run

The server will start on http://0.0.0.0:8080.

Test Authentication & Messaging

  1. Open two terminals.
  2. In each, connect via WebSocket:
websocat ws://localhost:8080/ws
  1. In both, authenticate (use different tokens):
{"type":"auth","payload":{"token":"alice"}}
{"type":"auth","payload":{"token":"bob"}}

You should receive:

{"type":"auth_ok"}
  1. From alice, send a message to bob:
{"type":"text","payload":{"to":"bob","text":"Hello from Alice!"}}
  1. bob will receive:
{"type":"text","payload":{"from":"alice","text":"Hello from Alice!"}}

Upload a File

Send POST request to http://localhost:8080/upload for example with curl:

curl -X POST --data-binary @yourfile.mp4 http://localhost:8080/upload

Response:

{"url":"/media/abcd1234.bin"}

Access it at: http://localhost:8080/media/abcd1234.bin


📂 Project Structure

src/
├── main.rs              # Entry point
├── messages.rs          # Message types (ClientMessage, AppMessage)
├── state.rs             # Shared in-memory state (online users)
├── ws.rs                # Just forwarding ws submodules
├── http.rs              # Just forwarding http submodules
├── ws/                  # WebSocket session logic
│   ├── session.rs       # Per-connection state & message handling
│   └── handler.rs       # WebSocket upgrade handler
└── http/                # HTTP handlers (upload, fallback)
    ├── upload.rs
    └── fallback.rs

🗺️ Roadmap

Feature Status
Text messaging ✅ Done
File uploads ✅ Done
Audio/video "circle" msgs ⏳ Planned
End-to-end encryption ⏳ Planned
WebRTC voice/video calls ⏳ Planned
Message history (SQLite) ⏳ Planned
Offline message queue ⏳ Planned
Group chats ⏳ Planned

The protocol is custom (not XMPP or Matrix), allowing full control over features and performance.


🔒 Security Notes

  • All connections should be served over TLS in production (add rustls support).
  • Authentication currently treats the token as the user ID (for MVP).
    → Will be replaced with JWT validation.
  • File uploads are stored on disk with random UUIDs (no execution allowed).
  • Input validation and rate limiting will be added before production use.

🛠️ Built With


📜 License

MIT — see LICENSE for details.


💡 Contributions, suggestions, and security feedback are welcome!
This project is designed to be minimal, auditable, and privacy-respecting from the ground up.

About

A rewrite to the auth stack to make it keypair centered. Made with ed25519, with x25519 in mind for future e2e.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 100.0%