pub struct Envelope<T> {Show 13 fields
pub protocol: String,
pub msg_id: MessageId,
pub msg_type: MsgType,
pub from_actor_id: ActorId,
pub to_actor_id: Option<ActorId>,
pub vision_id: Option<VisionId>,
pub project_id: Option<ProjectId>,
pub task_id: Option<TaskId>,
pub lamport_ts: u64,
pub created_at: OffsetDateTime,
pub expires_at: Option<OffsetDateTime>,
pub body: T,
pub signature: MessageSignature,
}Expand description
A signed envelope carrying a typed message body.
Fields§
§protocol: StringProtocol version string.
msg_id: MessageIdUnique message identifier.
msg_type: MsgTypeType discriminator matching the body.
from_actor_id: ActorIdActor that created this message.
to_actor_id: Option<ActorId>Intended recipient actor, if directed.
vision_id: Option<VisionId>Associated vision, if any.
project_id: Option<ProjectId>Associated project, if any.
task_id: Option<TaskId>Associated task, if any.
lamport_ts: u64Lamport logical timestamp for causal ordering.
created_at: OffsetDateTimeWall-clock creation time.
expires_at: Option<OffsetDateTime>Optional expiration time for this message.
body: TThe typed message body.
signature: MessageSignatureEd25519 signature over the canonical envelope content.
Implementations§
Source§impl<T> Envelope<T>where
T: RoutedBody + Serialize,
impl<T> Envelope<T>where
T: RoutedBody + Serialize,
Sourcepub fn verify_with_key(
&self,
verifying_key: &VerifyingKey,
) -> Result<(), ProtocolError>
pub fn verify_with_key( &self, verifying_key: &VerifyingKey, ) -> Result<(), ProtocolError>
Verifies the envelope’s signature against the given public key.
Sourcepub fn into_wire(self) -> Result<WireEnvelope, ProtocolError>
pub fn into_wire(self) -> Result<WireEnvelope, ProtocolError>
Converts this typed envelope into a wire-format envelope with untyped JSON body.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for Envelope<T>where
T: Freeze,
impl<T> RefUnwindSafe for Envelope<T>where
T: RefUnwindSafe,
impl<T> Send for Envelope<T>where
T: Send,
impl<T> Sync for Envelope<T>where
T: Sync,
impl<T> Unpin for Envelope<T>where
T: Unpin,
impl<T> UnsafeUnpin for Envelope<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Envelope<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more