diff --git a/src/comms.rs b/src/comms.rs new file mode 100644 index 00000000..43ef0607 --- /dev/null +++ b/src/comms.rs @@ -0,0 +1,26 @@ +use std::ops::Drop; + +use serde::Serialize; +use zeroize::Zeroize; + +/// This is a message sent between the Overlord and Minions +/// in either direction +#[derive(Debug, Clone, Serialize)] +pub struct BusMessage { + /// Indended recipient of the message + pub target: String, + + /// What kind of message is this + pub kind: String, + + /// The payload, serialized as a JSON string + pub json_payload: String, +} + +/// We may send passwords through BusMessage objects, so we zeroize +/// bus message payloads upon drop. +impl Drop for BusMessage { + fn drop(&mut self) { + self.json_payload.zeroize(); + } +} diff --git a/src/main.rs b/src/main.rs index 4878e914..4fbd83fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +mod comms; + fn main() { tracing_subscriber::fmt::init(); }