A high-performance, secure networking server built with Rust that provides user authentication, device registration, and secure key exchange functionality.
- User registration and authentication
- Device registration system
- Secure key bundle management
- Session handling with nonce-based security
- Handshake protocol implementation
- MySQL database integration
- Comprehensive logging system
- Runtime: Tokio async runtime
- Web Framework: Hyper
- Database: MySQL with SQLx
- Authentication: Ed25519 cryptographic signatures
- Serialization: Serde JSON
- Logging: Fern logger with configurable outputs
- Rust (2024 edition)
- MySQL server
- OpenSSL development libraries
-
Database Setup
# Create the database and run migrations mysql -u rudebhoys -p CREATE DATABASE rudebhoys; # Apply the migration from migrations/20250522112256_create_users_and_devices.sql
-
Environment
- Copy
secrets.env.exampletosecrets.env(if not exists) - Configure your database credentials and other environment variables
- Copy
-
Build and Run
export DATABASE_URL=---URL--- cargo build --release cargo run
POST /registerUser- Register a new userPOST /registerDevice- Register a new devicePOST /requestLogin- Initiate login processPOST /authenticate- Complete authenticationGET /keybundle/{id}- Retrieve key bundlePOST /updateKeybundle- Update key bundlePOST /handshake- Perform secure handshakeGET /status- Check service status
- Nonce-based authentication
- Session management
- Secure key exchange
- Ed25519 signature verification
- Request rate limiting
The project uses the following directory structure:
networking/
├── src/
│ ├── main.rs # Server setup and routing
│ ├── datatypes.rs # Core data structures
│ ├── server_utils.rs # Utility functions
│ └── routes/ # API endpoint handlers
└── Cargo.toml # Dependencies and project metadata
Logs are written to app.log with configurable log levels. The logging system uses Fern for formatting and file output.