Add Device Identity and Registration System Using Ed25519 and TCP with Persistent Device Identity Support#2
Conversation
Signed-off-by: ShigrafS <shigrafsalik@proton.me>
Signed-off-by: ShigrafS <shigrafsalik@proton.me>
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.
🧾 Summary
This PR introduces a new device registration system by replacing the existing
tcp_server.pyimplementation with a modular architecture consisting of:identity.py: Generates and persists a unique device identity and public key.register_client.py: Handles client-side registration to the central registry server.registry_server.py: Central registry server to assign unique 3-digit IDs and store device metadata.The change adds 133 lines of new code and removes 126 lines by removing the monolithic
tcp_server.py.📂 Changes Overview
✅ Added:
identity.pydevice_key.pem.device_id(first 20 chars of SHA-256 hash of the public key) and the PEM-encoded public key.register_client.pyget_device_id_and_key()fromidentity.py.device_id, public key, IP, port) to a registry server over TCP.registry_server.py9000for incoming client registrations.db.json.❌ Removed:
tcp_server.py🎯 Motivation
The previous
tcp_server.pylacked modularity, device identity persistence, and proper state tracking for registered clients.This PR addresses those issues by:
registry_server.pyuses basic threads; future improvements might involve async I/O or thread pooling for scalability.🧪 How to Test
Run the registry server:
Register a client device:
Expected Behavior:
db.jsonwith new device metadata.device_key.pemis created on first run and reused thereafter.📌 Related Tickets / References
tcp_server.py