Skip to content

feat(rust): replace python hardware identity with secure ed25519-dalek implementation#48

Open
Tenerife-Q wants to merge 2 commits intoc2siorg:mainfrom
Tenerife-Q:feat/rust-secure-identity
Open

feat(rust): replace python hardware identity with secure ed25519-dalek implementation#48
Tenerife-Q wants to merge 2 commits intoc2siorg:mainfrom
Tenerife-Q:feat/rust-secure-identity

Conversation

@Tenerife-Q
Copy link
Copy Markdown

Motivation

The official GSoC roadmap explicitly targets migrating the camera daemon to Rust and establishing "secure device cryptographic key generation using hardware entropy". Currently, hardware_identity.py handles this in Python, which is not memory-safe and less suitable for strict cryptographic device sealing.

Implementation

This PR sets up the foundational lensmint-identity Rust crate:

  • Drops the Python generation in favor of ed25519-dalek (v2).
  • Uses rand_core::OsRng to source true hardware-level entropy directly from the OS (/dev/urandom on Raspberry Pi) to guarantee uncloneable device keys.
  • Provides a clean, safe abstraction (DeviceIdentity) to extract the camera ID (hex public key) and sign metadata payloads.

Testing

Added unit tests to verify:

  • Hex encoding formatting for the 32-byte public key (Camera ID).
  • Signature generation and verification over a mock perceptual hash payload.

This PoC lays the groundwork for the broader Rust daemon rewrite planned for the summer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant