pub struct SealedSenderV2SentMessage<'a> {
pub version: u8,
pub recipients: IndexMap<ServiceId, SealedSenderV2SentMessageRecipient<'a>>,
/* private fields */
}
Expand description
A parsed representation of a Sealed Sender v2 SentMessage.
This only parses enough to fan out the message as a series of ReceivedMessages.
Fields§
§version: u8
The version byte at the head of the message.
recipients: IndexMap<ServiceId, SealedSenderV2SentMessageRecipient<'a>>
The parsed list of recipients, grouped by ServiceId.
The map is ordered by when a recipient first appears in the full message, even if they appear again later with more devices. This makes iteration over the full set of recipients deterministic.
Implementations§
source§impl<'a> SealedSenderV2SentMessage<'a>
impl<'a> SealedSenderV2SentMessage<'a>
sourcepub fn parse(data: &'a [u8]) -> Result<Self>
pub fn parse(data: &'a [u8]) -> Result<Self>
Parses the message, or produces an error if the message is invalid.
sourcepub fn received_message_parts_for_recipient(
&self,
recipient: &SealedSenderV2SentMessageRecipient<'a>,
) -> impl AsRef<[&[u8]]>
pub fn received_message_parts_for_recipient( &self, recipient: &SealedSenderV2SentMessageRecipient<'a>, ) -> impl AsRef<[&[u8]]>
Returns a slice of slices that, when concatenated, form the ReceivedMessage appropriate for
recipient
.
If recipient
is not one of the recipients in self
, the resulting message will not be
decryptable.
sourcepub fn range_for_recipient_key_material(
&self,
recipient: &SealedSenderV2SentMessageRecipient<'a>,
) -> Range<usize>
pub fn range_for_recipient_key_material( &self, recipient: &SealedSenderV2SentMessageRecipient<'a>, ) -> Range<usize>
Returns the range within the full message of recipient
’s user-specific key material.
This can be concatenated as [version, recipient_key_material, shared_bytes]
to produce a
valid SSv2 ReceivedMessage, the payload delivered to recipients.
Panics if recipient
is not one of the recipients in self
.
Returns the offset of the shared bytes within the full message.
This can be concatenated as [version, recipient_key_material, shared_bytes]
to produce a
valid SSv2 ReceivedMessage, the payload delivered to recipients.
Auto Trait Implementations§
impl<'a> Freeze for SealedSenderV2SentMessage<'a>
impl<'a> RefUnwindSafe for SealedSenderV2SentMessage<'a>
impl<'a> Send for SealedSenderV2SentMessage<'a>
impl<'a> Sync for SealedSenderV2SentMessage<'a>
impl<'a> Unpin for SealedSenderV2SentMessage<'a>
impl<'a> UnwindSafe for SealedSenderV2SentMessage<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more