Skip to content

Comments

Add Rust protobuf bindings (prost-build)#138

Draft
rucoder wants to merge 4 commits intolf-edge:mainfrom
rucoder:rucoder/rust-bindings
Draft

Add Rust protobuf bindings (prost-build)#138
rucoder wants to merge 4 commits intolf-edge:mainfrom
rucoder:rucoder/rust-bindings

Conversation

@rucoder
Copy link

@rucoder rucoder commented Feb 19, 2026

Summary

Add auto-generated Rust bindings for all EVE Device API v2 protobuf packages using prost. Bindings are generated at build time from .proto sources — no pre-generated files committed.

Work in progress — the bindings are functional and tested, but the crate API surface may evolve as downstream consumers mature.

TODO:

  • Get rid of file read operation in traits
  • Add example?
  • Cleanup tests

What's included

  • rust/build.rs — compiles all proto packages via prost-build (evecommon, auth, register, certs, attest, config, info, metrics, logs, flowlog, eveuuid, hardwarehealth, profile, nestedappinstancemetrics)
  • rust/src/lib.rs — module declarations with doc comments, convenience re-exports (AuthContainer, EdgeDevConfig, ZRegisterMsg, etc.), and roundtrip tests
  • rust/Cargo.toml — prost 0.13, bytes, clippy lint suppressions for generated code
  • Makefilerust, rust-test, rust-check, rust-clean targets; rust integrated into proto-local
  • .gitignorerust/target/

Design decisions

  • Build-time generation — no checked-in .rs files. Consumers only need the proto sources and a Rust toolchain (prost-build is pure Rust, no protoc binary required).
  • bytes::Bytes for all binary fields — zero-copy efficiency for payloads like AuthContainer.signature_hash and ZRegisterMsg.pem_cert.
  • One module per proto package — mirrors the Go/Python layout. Proto dependency order is explicit in build.rs.
  • Clippy lints suppressed for empty_docs, doc_lazy_continuation, doc_overindented_list_items, and large_enum_variant — all originate from generated code.

Downstream usage

These bindings are consumed by micro-eve, a Rust implementation of an EVE-compatible device agent. The following endpoints are working end-to-end with these types: /ping, /certs, /register, /uuid.

Testing

cd rust && cargo test

@rucoder rucoder force-pushed the rucoder/rust-bindings branch 5 times, most recently from 40d1dbd to 163d6f5 Compare February 19, 2026 14:59
- rust/build.rs: compile all proto packages via prost-build
- rust/src/lib.rs: module declarations with doc comments and re-exports
- rust/Cargo.toml: prost 0.13, bytes, clippy lints for generated code
- Makefile: add rust, rust-test, rust-check, rust-clean targets
- .gitignore: add rust/target/ and swagger/

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
Add Rust toolchain (rustup, clippy, rustfmt, gcc, musl-dev) to the
devcontainer Dockerfile. Rust builds alongside Go and Python as part
of proto-local. Pass PROTO_DEPS_DIR to cargo so build.rs finds
validate.proto from the container's proto deps.

local build still fetches validate.proto from net

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rucoder rucoder force-pushed the rucoder/rust-bindings branch from 163d6f5 to af29e2a Compare February 19, 2026 15:21
@rucoder rucoder marked this pull request as draft February 19, 2026 15:41
Fixes clippy::uninlined_format_args warnings introduced in Rust 1.87+.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rucoder rucoder force-pushed the rucoder/rust-bindings branch 3 times, most recently from adfdbe5 to 0a01d1c Compare February 22, 2026 00:42
…Authenticatable)

Add eve_api::crypto module with protocol-level cryptographic traits for
EVE Device API OBJECT-SIGNING authentication.

Traits:
- Signer: sign(data) -> fixed R||S, verify(data, sig, cert) -> bool
- CertStore: device/signing cert access (DER + hash + PEM)
- CryptoProvider: Signer + CertStore bound
- Authenticatable: blanket impl for prost::Message -> AuthContainer

Also adds CryptoError enum for structured error handling across
crypto implementations (software, TPM, etc.).

Dependencies added: thiserror 2, base64 0.22

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rucoder rucoder force-pushed the rucoder/rust-bindings branch from 0a01d1c to 9ddf638 Compare February 22, 2026 01:06
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