pub struct EncryptedMessage {
pub group_id: GroupId,
pub message_type: MlsMessageType,
pub epoch: u64,
pub ciphertext: Vec<u8>,
pub sender_id: String,
pub timestamp_ms: u64,
}Expand description
The sealed-envelope types, re-exported so that every path into them keeps working and there is still exactly one definition of each.
They live in offline-protocol-sealed because a leaf node encodes and
decodes the same envelope this crate does, and cannot link this crate:
this one is built on OpenMLS, which needs std. See ADR 0022.
An encrypted MLS message ready for transport.
Fields§
§group_id: GroupIdThe group ID this message belongs to.
message_type: MlsMessageTypeType of MLS message.
epoch: u64Current epoch when the message was created.
ciphertext: Vec<u8>Serialized MLS message bytes.
sender_id: StringSender’s user ID.
timestamp_ms: u64Timestamp when the message was created.
Implementations§
Source§impl EncryptedMessage
impl EncryptedMessage
Sourcepub fn to_base64(&self) -> Result<String, SealedError>
pub fn to_base64(&self) -> Result<String, SealedError>
Encodes the encrypted message to base64 for transport.
Sourcepub fn from_base64(encoded: &str) -> Result<EncryptedMessage, SealedError>
pub fn from_base64(encoded: &str) -> Result<EncryptedMessage, SealedError>
Decodes an encrypted message from base64.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serializes to a compact binary format, avoiding base64/JSON overhead.
JSON renders ciphertext as an integer array (~3.7x inflation), which
is unacceptable for large payloads such as encrypted file chunks.
Wire format (all multi-byte integers are little-endian):
[group_id_len:4][group_id][sender_len:4][sender_id]
[message_type:1][epoch:8][timestamp_ms:8]
[ciphertext_len:4][ciphertext]Sourcepub fn from_bytes(data: &[u8]) -> Result<EncryptedMessage, SealedError>
pub fn from_bytes(data: &[u8]) -> Result<EncryptedMessage, SealedError>
Deserializes from the compact binary format produced by to_bytes.
Trait Implementations§
Source§impl Clone for EncryptedMessage
impl Clone for EncryptedMessage
Source§fn clone(&self) -> EncryptedMessage
fn clone(&self) -> EncryptedMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EncryptedMessage
impl Debug for EncryptedMessage
Source§impl<'de> Deserialize<'de> for EncryptedMessage
impl<'de> Deserialize<'de> for EncryptedMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EncryptedMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EncryptedMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for EncryptedMessage
impl Serialize for EncryptedMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for EncryptedMessage
impl RefUnwindSafe for EncryptedMessage
impl Send for EncryptedMessage
impl Sync for EncryptedMessage
impl Unpin for EncryptedMessage
impl UnsafeUnpin for EncryptedMessage
impl UnwindSafe for EncryptedMessage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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