Feat/inter node messaging#2
Merged
Merged
Conversation
- 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.
…proved readability
…ved readability and maintainability
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
federation_nodes(peer registry),used_node_nonces(anti-replay protection), andfederation_outbox(outbound message queue) to support inter-node federation and secure message delivery. [1] [2]userstable withhome_node_idandfederated_addresscolumns to uniquely identify users across nodes, and added a deduplication constraint to themessagestable for idempotent S2S delivery. [1] [2]Application and environment configuration:
docker-compose.ymlto 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]Dockerfileto ensure the.hushnetdirectory exists and is owned by the correct user for secure key storage.Codebase updates for federation support:
AppStateto include fields for this node’s identity, API URL, registry URL, node keys, and a shared HTTP client, enabling federation logic throughout the backend.messages_controller.rsto integrate federation-related models, repositories, and utility functions.Dependency updates:
sha2andhexcrates toCargo.tomlin preparation for cryptographic operations required by federation.Query and data model changes:
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.