Skip to main content

ConversationMut

Struct ConversationMut 

Source
pub struct ConversationMut { /* private fields */ }
Expand description

A mutable view of an MLS conversation.

The conversation is ultimately owned by the conversation cache, but we take an Arc here so that we don’t have to tie the lifetime of the guard to the cache.

More generally, the conversation guard gives us convenient mutable accesses to a single conversation. This in turn means that we don’t have to duplicate the entire conversation API on TransactionContext.

Implementations§

Source§

impl ConversationMut

Source

pub async fn add_members( &mut self, key_packages: Vec<KeyPackageIn>, ) -> Result<()>

Adds new members to the group/conversation

Source

pub async fn remove_members( &mut self, clients: &[impl Borrow<ClientIdRef>], ) -> Result<()>

Removes clients from the group/conversation.

§Arguments
  • id - group/conversation id
  • clients - list of client ids to be removed from the group
Source

pub async fn update_key_material(&mut self) -> Result<()>

Self updates the own leaf node and automatically commits. Pending proposals will be committed.

Source

pub async fn set_credential_by_ref( &mut self, credential_ref: &CredentialRef, ) -> Result<()>

Set the referenced credential for this conversation.

Source

pub async fn commit_pending_proposals(&mut self) -> Result<()>

Commits all pending proposals of the group

Source§

impl ConversationMut

Source

pub async fn decrypt_message( &mut self, message: impl AsRef<[u8]>, ) -> Result<DecryptedMessage>

Deserializes a TLS-serialized message, then processes it. Note: this will discard any local pending commits or proposals.

§Arguments
  • message - the encrypted message as a byte array
§Errors

If a message has been buffered, this will be indicated by an error. Other errors are originating from OpenMls and the KeyStore

Source§

impl ConversationMut

Source

pub async fn encrypt_message( &mut self, message: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Encrypts a raw payload then serializes it to the TLS wire format.

Can only be called when there is no pending commit and no pending proposal.

§Arguments
  • message - the message as a byte array
§Return type

This method will return an encrypted TLS serialized message.

§Errors

If the conversation can’t be found, an error will be returned. Other errors are originating from OpenMls and the KeyStore

Source§

impl ConversationMut

Source

pub async fn enable_history_sharing(&mut self) -> Result<()>

Enable history sharing by generating a history client and adding it to the conversation.

Source

pub async fn disable_history_sharing(&mut self) -> Result<()>

Disable history sharing by removing history clients from the conversation.

Source§

impl ConversationMut

Source

pub async fn wipe(&mut self) -> Result<()>

Destroys a group locally

§Errors

KeyStore errors, such as IO

Source§

impl ConversationMut

Source

pub const fn new( inner: Arc<Conversation>, tx_context: TransactionContext, ) -> ConversationMut

Trait Implementations§

Source§

impl Debug for ConversationMut

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for ConversationMut

Source§

type Target = <Arc<Conversation> as Deref>::Target

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T