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§
Sourcefn orphan(&self) -> Result<OrphanedEnvelope, EnvelopeError>
fn orphan(&self) -> Result<OrphanedEnvelope, EnvelopeError>
get the orphaned version of this envelope
Sourcefn topic(&self) -> Result<Topic, EnvelopeError>
fn topic(&self) -> Result<Topic, EnvelopeError>
Extract the topic for this envelope
Sourcefn cursor(&self) -> Result<Cursor, EnvelopeError>
fn cursor(&self) -> Result<Cursor, EnvelopeError>
Extract the cursor for this envelope
Sourcefn depends_on(&self) -> Result<Option<GlobalCursor>, EnvelopeError>
fn depends_on(&self) -> Result<Option<GlobalCursor>, EnvelopeError>
get the envelope this depends on.
Sourcefn payload(&self) -> Result<Payload, EnvelopeError>
fn payload(&self) -> Result<Payload, EnvelopeError>
Extract the payload for this envelope
Sourcefn sha256_hash(&self) -> Result<Vec<u8>, EnvelopeError>
fn sha256_hash(&self) -> Result<Vec<u8>, EnvelopeError>
the Mls Data bytes as a sha256 hash
Sourcefn client_envelope(&self) -> Result<ClientEnvelope, EnvelopeError>
fn client_envelope(&self) -> Result<ClientEnvelope, EnvelopeError>
Extract the client envelope (envelope containing message payload & AAD, if any) for this envelope.
Sourcefn group_message(&self) -> Result<Option<GroupMessage>, EnvelopeError>
fn group_message(&self) -> Result<Option<GroupMessage>, EnvelopeError>
Try to get a group message from this Envelope
Sourcefn welcome_message(&self) -> Result<Option<WelcomeMessage>, EnvelopeError>
fn welcome_message(&self) -> Result<Option<WelcomeMessage>, EnvelopeError>
Try to get a welcome message