Envelope

Trait Envelope 

Source
pub trait Envelope<'env>:
    Debug
    + MaybeSend
    + MaybeSync {
    // Required methods
    fn bytes(&self) -> Result<Vec<u8>, EnvelopeError>;
    fn orphan(&self) -> Result<OrphanedEnvelope, EnvelopeError>;
    fn topic(&self) -> Result<Topic, EnvelopeError>;
    fn cursor(&self) -> Result<Cursor, EnvelopeError>;
    fn depends_on(&self) -> Result<Option<GlobalCursor>, EnvelopeError>;
    fn payload(&self) -> Result<Payload, EnvelopeError>;
    fn sha256_hash(&self) -> Result<Vec<u8>, EnvelopeError>;
    fn timestamp(&self) -> Option<DateTime<Utc>>;
    fn client_envelope(&self) -> Result<ClientEnvelope, EnvelopeError>;
    fn group_message(&self) -> Result<Option<GroupMessage>, EnvelopeError>;
    fn welcome_message(&self) -> Result<Option<WelcomeMessage>, EnvelopeError>;
}
Expand description

Represents a Single High-Level Envelope An Envelope is a ProtocolEnvelope with some Extractor applied to it. Envelopes received from the network generally must adhere to the form of envelopes expected in d14n Node2Node Protocol. In the network, Node operators are responseible for maintaining a Cursor per envelope. Likewise, Clients form the ClientEnvelope according to the Client Node2Node Protocol Client envelopes maintain a payload/topic with MLS and Client-specific duties.

Required Methods§

Source

fn bytes(&self) -> Result<Vec<u8>, EnvelopeError>

get the oriignal envelope bytes

Source

fn orphan(&self) -> Result<OrphanedEnvelope, EnvelopeError>

get the orphaned version of this envelope

Source

fn topic(&self) -> Result<Topic, EnvelopeError>

Extract the topic for this envelope

Source

fn cursor(&self) -> Result<Cursor, EnvelopeError>

Extract the cursor for this envelope

Source

fn depends_on(&self) -> Result<Option<GlobalCursor>, EnvelopeError>

get the envelope this depends on.

Source

fn payload(&self) -> Result<Payload, EnvelopeError>

Extract the payload for this envelope

Source

fn sha256_hash(&self) -> Result<Vec<u8>, EnvelopeError>

the Mls Data bytes as a sha256 hash

Source

fn timestamp(&self) -> Option<DateTime<Utc>>

Get the timestamp of this envelope

Source

fn client_envelope(&self) -> Result<ClientEnvelope, EnvelopeError>

Extract the client envelope (envelope containing message payload & AAD, if any) for this envelope.

Source

fn group_message(&self) -> Result<Option<GroupMessage>, EnvelopeError>

Try to get a group message from this Envelope

Source

fn welcome_message(&self) -> Result<Option<WelcomeMessage>, EnvelopeError>

Try to get a welcome message

Implementors§

Source§

impl<'env, T> Envelope<'env> for T
where T: ProtocolEnvelope<'env>,