pub struct Envelope {Show 14 fields
pub acl: u8,
pub msg_id: String,
pub in_reply_to: Option<String>,
pub from: Aid,
pub to: Aid,
pub ts: i64,
pub ttl: u32,
pub reply_with: Option<String>,
pub hop_count: u8,
pub performative: Performative,
pub body: Body,
pub sig: Option<Vec<u8>>,
pub rational_effect: Option<String>,
pub feasibility_precondition: Option<String>,
}Expand description
The ACL envelope (spec §4). Field order is wire order.
Fields§
§acl: u8§msg_id: String128-bit id, hex-encoded (32 chars).
in_reply_to: Option<String>§from: Aid§to: Aid§ts: i64unix milliseconds UTC
ttl: u32§reply_with: Option<String>§hop_count: u8§performative: Performative§body: Body§sig: Option<Vec<u8>>Ed25519 signature over the encoded envelope with sig absent.
rational_effect: Option<String>§30: what the sender EXPECTS to happen in the world if the message is honoured (rational effect). Machine-checkable against the sender’s declared semantics.
feasibility_precondition: Option<String>§30: what must have been true of the sender for this message to be sincere (feasibility precondition).
Implementations§
Source§impl Envelope
impl Envelope
pub fn new(from: Aid, to: Aid, performative: Performative, body: Body) -> Self
Sourcepub fn with_intent(self, fp: &str, re: &str) -> Self
pub fn with_intent(self, fp: &str, re: &str) -> Self
§30: declare the intent pair (FP/RE) on this envelope.
Sourcepub fn encode_unsigned(&self) -> Result<Vec<u8>, AclError>
pub fn encode_unsigned(&self) -> Result<Vec<u8>, AclError>
Serialize the unsigned envelope (what the signature covers).
pub fn decode(bytes: &[u8]) -> Result<Self, AclError>
Sourcepub fn sign(&mut self, key: &SigningKey) -> Result<(), AclError>
pub fn sign(&mut self, key: &SigningKey) -> Result<(), AclError>
Sign with an Ed25519 key. sig covers the envelope without sig.
Sourcepub fn verify(&self, vk: &VerifyingKey) -> Result<bool, AclError>
pub fn verify(&self, vk: &VerifyingKey) -> Result<bool, AclError>
Verify the signature against a public key.
pub fn is_expired(&self, now_ms: i64) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Envelope
impl<'de> Deserialize<'de> for Envelope
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 Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnsafeUnpin for Envelope
impl UnwindSafe for Envelope
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