2026-02-24 09:12:28 +00:00
|
|
|
//! Ed25519 cryptographic primitives for distribution.
|
|
|
|
|
|
refactor: remove dead code, consolidate files (#52)
Remove the unused TCP transport and dead CLI/simulation scaffolding and collapse scattered single-purpose modules into consolidated files across the dashboard, process, and simulation crates.
- crates/transport: drop the TCP transport (src/tcp.rs and its tcp feature), leaving only ed25519 identity and encoding utilities behind the iroh transport
- crates/dashboard: collapse actor_detail_html/actors_html/dashboard_html/topology_html into a single html.rs, drop command/parse.rs, and inline the trace types into lib.rs
- crates/process: fold driver, pipeline_types, queue, subscriber, waker, and local pipes/signal/wait into local/mod.rs, pipeline.rs, and a unified types.rs, consolidating the public re-exports
- crates/simulation: remove the ci subdirectory (local_sim, sim) and dead node/config/trace modules, and flatten the distribution subdirectory into top-level files
- crates/datastore: remove the unused store_cli, cli, and in-memory storage, and deduplicate crypto.rs across datastore and distribution (about 190 lines of shared code removed)
- crates/distribution: drop dead codec code and trim the messages module
Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
2026-02-25 14:33:04 +00:00
|
|
|
pub use swactor_transport::crypto::{Keypair, Signature, verify};
|
2026-02-24 09:12:28 +00:00
|
|
|
|
refactor: remove dead code, consolidate files (#52)
Remove the unused TCP transport and dead CLI/simulation scaffolding and collapse scattered single-purpose modules into consolidated files across the dashboard, process, and simulation crates.
- crates/transport: drop the TCP transport (src/tcp.rs and its tcp feature), leaving only ed25519 identity and encoding utilities behind the iroh transport
- crates/dashboard: collapse actor_detail_html/actors_html/dashboard_html/topology_html into a single html.rs, drop command/parse.rs, and inline the trace types into lib.rs
- crates/process: fold driver, pipeline_types, queue, subscriber, waker, and local pipes/signal/wait into local/mod.rs, pipeline.rs, and a unified types.rs, consolidating the public re-exports
- crates/simulation: remove the ci subdirectory (local_sim, sim) and dead node/config/trace modules, and flatten the distribution subdirectory into top-level files
- crates/datastore: remove the unused store_cli, cli, and in-memory storage, and deduplicate crypto.rs across datastore and distribution (about 190 lines of shared code removed)
- crates/distribution: drop dead codec code and trim the messages module
Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
2026-02-25 14:33:04 +00:00
|
|
|
use crate::types::{DirectoryEntry, DirectoryEntryPayload};
|
2026-02-24 09:12:28 +00:00
|
|
|
|
|
|
|
|
// ─── Directory Entry Helpers ────────────────────────────────────────────────
|
2026-02-12 09:13:50 +00:00
|
|
|
|
2026-02-24 09:12:28 +00:00
|
|
|
/// Extension methods for Keypair specific to distribution directory entries.
|
|
|
|
|
pub trait KeypairExt {
|
2026-02-12 09:13:50 +00:00
|
|
|
/// Sign a directory entry payload, returning a complete `DirectoryEntry`.
|
2026-02-24 09:12:28 +00:00
|
|
|
fn sign_directory_entry(
|
|
|
|
|
&self,
|
|
|
|
|
actor_addr: swactor::actor::ActorAddress,
|
|
|
|
|
generation: u64,
|
|
|
|
|
) -> DirectoryEntry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl KeypairExt for Keypair {
|
|
|
|
|
fn sign_directory_entry(
|
2026-02-12 09:13:50 +00:00
|
|
|
&self,
|
|
|
|
|
actor_addr: swactor::actor::ActorAddress,
|
|
|
|
|
generation: u64,
|
|
|
|
|
) -> DirectoryEntry {
|
|
|
|
|
let payload = DirectoryEntryPayload {
|
|
|
|
|
actor_addr,
|
|
|
|
|
node_id: self.node_id(),
|
|
|
|
|
generation,
|
|
|
|
|
};
|
2026-06-23 15:42:28 +00:00
|
|
|
let bytes =
|
|
|
|
|
serde_json::to_vec(&payload).expect("DirectoryEntryPayload is always serializable");
|
2026-02-12 09:13:50 +00:00
|
|
|
let signature = self.sign(&bytes);
|
|
|
|
|
DirectoryEntry {
|
|
|
|
|
actor_addr,
|
|
|
|
|
node_id: self.node_id(),
|
|
|
|
|
generation,
|
|
|
|
|
signature,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Verify a `DirectoryEntry`'s signature against its embedded `node_id`.
|
|
|
|
|
pub fn verify_directory_entry(entry: &DirectoryEntry) -> bool {
|
|
|
|
|
let payload = entry.payload();
|
|
|
|
|
let Ok(bytes) = serde_json::to_vec(&payload) else {
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
verify(&entry.node_id, &bytes, &entry.signature)
|
|
|
|
|
}
|