Skip to content

Feat/inter node messaging#2

Merged
AdamLBS merged 23 commits into
mainfrom
feat/inter-node-messaging
Apr 26, 2026
Merged

Feat/inter node messaging#2
AdamLBS merged 23 commits into
mainfrom
feat/inter-node-messaging

Conversation

@AdamLBS
Copy link
Copy Markdown
Contributor

@AdamLBS AdamLBS commented Apr 26, 2026

This pull request introduces foundational support for inter-node federation, enabling cross-node message routing and peer discovery. It includes major database schema migrations, environment configuration updates, and supporting code changes to manage node identity and S2S (server-to-server) communication. The changes are grouped by theme below.

Database schema migrations for federation:

  • Added new tables: federation_nodes (peer registry), used_node_nonces (anti-replay protection), and federation_outbox (outbound message queue) to support inter-node federation and secure message delivery. [1] [2]
  • Extended the users table with home_node_id and federated_address columns to uniquely identify users across nodes, and added a deduplication constraint to the messages table for idempotent S2S delivery. [1] [2]

Application and environment configuration:

  • Updated docker-compose.yml to add new environment variables for node federation (NODE_NAME, NODE_HOST, NODE_API_URL, REGISTRY_URL, etc.), mount a volume for node keys, and adjust port/healthcheck configuration for flexibility. [1] [2]
  • Modified the Dockerfile to ensure the .hushnet directory exists and is owned by the correct user for secure key storage.

Codebase updates for federation support:

  • Extended AppState to include fields for this node’s identity, API URL, registry URL, node keys, and a shared HTTP client, enabling federation logic throughout the backend.
  • Updated imports and dependencies in messages_controller.rs to integrate federation-related models, repositories, and utility functions.

Dependency updates:

  • Added sha2 and hex crates to Cargo.toml in preparation for cryptographic operations required by federation.

Query and data model changes:

  • Updated chat listing queries to include partner_federated_address, ensuring correct cross-node addressing in direct chats. [1] [2]

These changes lay the groundwork for secure, robust inter-node federation and are a prerequisite for enabling cross-node messaging and user discovery.

AdamLBS added 21 commits April 18, 2026 15:49
- Add federation module with client and outbox components.
- Implement outbox worker for durable cross-node message delivery with exponential backoff.
- Create node authentication middleware to validate S2S requests from peer nodes.
- Define models for federation nodes and outbox entries.
- Implement repository functions for managing federation nodes and outbox entries.
- Add S2S routes for node-to-node communication, including info, user devices, keys, sessions, and message handling.
- Update main application to initialize federation components and start outbox worker.
@AdamLBS AdamLBS self-assigned this Apr 26, 2026
@AdamLBS AdamLBS added the enhancement New feature or request label Apr 26, 2026
AdamLBS added 2 commits April 26, 2026 10:53
- Bump axum from 0.7 to 0.8 and update related dependencies.
- Upgrade uuid to 1.23.1 and chrono to 0.4.44 for improved functionality.
- Update jsonwebtoken to 10.3.0, reqwest to 0.13.2, and sha2 to 0.11 for security and performance enhancements.
- Remove unused fetch_node_info method from FederationClient.
- Add clippy lint allowance for too many arguments in insert_federated_message function.
- Remove commented-out get_user_by_username function from user_repository.rs.
- Updated `reqwest` to disable default features and added `async-trait` dependency.
- Removed unused imports from `client.rs` to clean up the code.
- Removed `async_trait` attribute from `AuthenticatedDevice` and `AuthenticatedNode` in middleware files to simplify implementation.
- Fixed websocket message sending by converting JSON string to `Message::Text` directly.
@AdamLBS AdamLBS merged commit d8c5e97 into main Apr 26, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant