pub struct ConversationGuard { /* private fields */ }
Expand description
A Conversation Guard wraps a GroupStoreValue<MlsConversation>
.
By doing so, it permits mutable accesses to the conversation. This in turn
means that we don’t have to duplicate the entire MlsConversation
API
on CentralContext
.
Implementations§
Source§impl ConversationGuard
impl ConversationGuard
Sourcepub async fn add_members(
&mut self,
key_packages: Vec<KeyPackageIn>,
) -> Result<NewCrlDistributionPoint>
pub async fn add_members( &mut self, key_packages: Vec<KeyPackageIn>, ) -> Result<NewCrlDistributionPoint>
Adds new members to the group/conversation
Sourcepub async fn remove_members(&mut self, clients: &[ClientId]) -> Result<()>
pub async fn remove_members(&mut self, clients: &[ClientId]) -> Result<()>
Removes clients from the group/conversation.
§Arguments
id
- group/conversation idclients
- list of client ids to be removed from the group
Sourcepub async fn update_key_material(&mut self) -> Result<()>
pub async fn update_key_material(&mut self) -> Result<()>
Self updates the KeyPackage and automatically commits. Pending proposals will be commited.
§Arguments
conversation_id
- the group/conversation id
see [MlsCentral::update_keying_material]
Sourcepub async fn e2ei_rotate(&mut self, cb: Option<&CredentialBundle>) -> Result<()>
pub async fn e2ei_rotate(&mut self, cb: Option<&CredentialBundle>) -> Result<()>
Send a commit in a conversation for changing the credential. Requires first having enrolled a new X509 certificate with either crate::context::CentralContext::e2ei_new_activation_enrollment or crate::context::CentralContext::e2ei_new_rotate_enrollment and having saved it with crate::context::CentralContext::save_x509_credential.
Sourcepub async fn commit_pending_proposals(&mut self) -> Result<()>
pub async fn commit_pending_proposals(&mut self) -> Result<()>
Commits all pending proposals of the group
Source§impl ConversationGuard
impl ConversationGuard
Sourcepub async fn decrypt_message(
&mut self,
message: impl AsRef<[u8]>,
) -> Result<MlsConversationDecryptMessage>
pub async fn decrypt_message( &mut self, message: impl AsRef<[u8]>, ) -> Result<MlsConversationDecryptMessage>
Deserializes a TLS-serialized message, then processes it
§Arguments
message
- the encrypted message as a byte array
§Returns
An MlsConversationDecryptMessage
§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 ConversationGuard
impl ConversationGuard
Sourcepub async fn encrypt_message(
&mut self,
message: impl AsRef<[u8]>,
) -> Result<Vec<u8>>
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 ConversationGuard
impl ConversationGuard
Sourcepub async fn clear_pending_proposal(
&mut self,
proposal_ref: MlsProposalRef,
) -> Result<()>
pub async fn clear_pending_proposal( &mut self, proposal_ref: MlsProposalRef, ) -> Result<()>
Allows to remove a pending (uncommitted) proposal. Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
CAUTION: only use this when you had an explicit response from the Delivery Service e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc..
§Arguments
conversation_id
- the group/conversation idproposal_ref
- unique proposal identifier which is present in crate::prelude::MlsProposalBundle and returned from all operation creating a proposal
§Errors
When the conversation is not found or the proposal reference does not identify a proposal in the local pending proposal store
Source§impl ConversationGuard
impl ConversationGuard
Sourcepub async fn mark_as_child_of(
&mut self,
parent_id: &ConversationId,
) -> Result<()>
pub async fn mark_as_child_of( &mut self, parent_id: &ConversationId, ) -> Result<()>
Marks this conversation as child of another. Prerequisite: Must be a member of the parent group, and it must exist in the keystore
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConversationGuard
impl !RefUnwindSafe for ConversationGuard
impl Send for ConversationGuard
impl Sync for ConversationGuard
impl Unpin for ConversationGuard
impl !UnwindSafe for ConversationGuard
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<'a, T> Conversation<'a> for Twhere
T: ConversationWithMls<'a>,
impl<'a, T> Conversation<'a> for Twhere
T: ConversationWithMls<'a>,
Source§fn epoch<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn epoch<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn ciphersuite<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = MlsCiphersuite> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn ciphersuite<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = MlsCiphersuite> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn export_secret_key<'async_trait>(
&'a self,
key_length: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn export_secret_key<'async_trait>(
&'a self,
key_length: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn get_client_ids<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Vec<ClientId>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn get_client_ids<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Vec<ClientId>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn get_external_sender<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn get_external_sender<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn e2ei_conversation_state<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<E2eiConversationState>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
fn e2ei_conversation_state<'async_trait>(
&'a self,
) -> Pin<Box<dyn Future<Output = Result<E2eiConversationState>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
Source§fn get_device_identities<'life0, 'async_trait>(
&'a self,
device_ids: &'life0 [ClientId],
) -> Pin<Box<dyn Future<Output = Result<Vec<WireIdentity>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn get_device_identities<'life0, 'async_trait>(
&'a self,
device_ids: &'life0 [ClientId],
) -> Pin<Box<dyn Future<Output = Result<Vec<WireIdentity>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Source§fn get_user_identities<'life0, 'async_trait>(
&'a self,
user_ids: &'life0 [String],
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<WireIdentity>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn get_user_identities<'life0, 'async_trait>(
&'a self,
user_ids: &'life0 [String],
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<WireIdentity>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
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