Skip to main content

Conversation

Struct Conversation 

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

A Conversation exposes the read-only interface of an MLS conversation.

Implementations§

Source§

impl Conversation

Source

pub async fn get_client_ids(&self) -> Result<Vec<ClientId>>

Exports the clients from a conversation Does NOT include history client ids.

Source

pub async fn get_history_client_ids(&self) -> Vec<Vec<u8>>

Exports the history client ids from a conversation

Source

pub async fn members_in_next_epoch(&self) -> Result<Vec<ClientId>>

Get actual group members and subtract pending remove proposals

Source§

impl Conversation

Source

pub async fn compute_next_commit_delay(&self) -> Option<u64>

A deterministic delay, in seconds, which this client should wait before committing the conversation’s pending proposals.

The delay is derived from this client’s position in the ratchet tree and the current epoch, so that members of a group stagger their commits rather than racing to commit the same proposals.

Returns None in two cases, which callers have to distinguish:

  • there are no pending proposals, so there is nothing to commit;
  • a pending proposal removes this client, so it must not commit at all.
Source§

impl Conversation

Source

pub async fn members(&self) -> HashMap<Vec<u8>, MlsCredential>

Returns all members credentials from the group/conversation

Source

pub async fn members_with_key( &self, ) -> Result<HashMap<ClientId, CredentialWithKey>>

Returns all members credentials with their signature public key from the group/conversation

Source§

impl Conversation

Source

pub async fn e2ei_conversation_state(&self) -> Result<E2eiConversationState>

Indicates when to mark a conversation as not verified i.e. when not all its members have a X509 Credential generated by Wire’s end-to-end identity enrollment

Source

pub async fn get_device_identities( &self, device_ids: &[impl Borrow<ClientIdRef> + Sync], ) -> Result<Vec<WireIdentity>>

From a given conversation, get the identity of the members supplied.

An identity is returned for every requested member which is in the conversation, whatever its credential type. Members with an X509 credential additionally carry a WireIdentity::x509_identity; members with a basic credential do not, and their status is always Valid, which on its own is no evidence of end-to-end identity enrolment.

Source

pub async fn get_user_identities( &self, user_ids: &[Uuid], ) -> Result<HashMap<Uuid, Vec<WireIdentity>>>

From a given conversation, get the identity of the users (device holders) supplied.

As with Self::get_device_identities, an identity is returned for every device of every requested user, whatever its credential type; only devices with an X509 credential carry a WireIdentity::x509_identity.

Returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.

Source§

impl Conversation

Source

pub async fn generate_history_secret(&self) -> Result<HistorySecret>

Generate a new crate::HistorySecret.

This is useful when it’s this client’s turn to generate a new history client.

The generated secret is cryptographically unrelated to the current CoreCrypto client.

Source

pub async fn is_history_sharing_enabled(&self) -> bool

Check if history sharing is enabled, i.e., if any of the conversation members have a ClientId starting with crate::HISTORY_CLIENT_ID_PREFIX.

Source§

impl Conversation

Source

pub const fn new( id: ConversationId, group: RwLock<MlsGroupState>, configuration: ConversationConfiguration, session: Session, ) -> Conversation

Source§

impl Conversation

Source

pub fn id(&self) -> &ConversationIdRef

Returns the conversation’s ID

Source

pub fn configuration(&self) -> &ConversationConfiguration

Returns the conversation’s configuration

Source

pub async fn epoch(&self) -> u64

Returns current epoch of the MLS group

Source

pub fn cipher_suite(&self) -> CipherSuite

Returns this conversation’s cipher suite

Source

pub async fn credential_ref(&self) -> Result<CredentialRef>

Returns a reference to the credential used in this conversation

Source

pub async fn export_secret_key(&self, key_length: usize) -> Result<SecretKey>

Derives a new key from the one in the group, to be used elsewhere.

§Arguments
  • key_length - the length of the key to be derived. If the value is higher than the bounds of u16 or the context hash * 255, an error will be returned
§Errors

OpenMls secret generation error

Source

pub async fn get_external_sender(&self) -> Result<ExternalSender>

Returns the first external sender present in this group.

This should be used to initialize a subconversation

Trait Implementations§

Source§

impl Debug for Conversation

Source§

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

Formats the value using the given formatter. Read more

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
§

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

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
§

impl<T> MaybeSendSync for T

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