Trait mls_rs::group::mls_rules::MlsRules

source ·
pub trait MlsRules: Send + Sync {
    type Error: IntoAnyError;

    // Required methods
    fn filter_proposals(
        &self,
        direction: CommitDirection,
        source: CommitSource,
        current_roster: &Roster<'_>,
        extension_list: &ExtensionList,
        proposals: ProposalBundle,
    ) -> Result<ProposalBundle, Self::Error>;
    fn commit_options(
        &self,
        new_roster: &Roster<'_>,
        new_extension_list: &ExtensionList,
        proposals: &ProposalBundle,
    ) -> Result<CommitOptions, Self::Error>;
    fn encryption_options(
        &self,
        current_roster: &Roster<'_>,
        current_extension_list: &ExtensionList,
    ) -> Result<EncryptionOptions, Self::Error>;
}
Expand description

A set of user controlled rules that customize the behavior of MLS.

Required Associated Types§

Required Methods§

source

fn filter_proposals( &self, direction: CommitDirection, source: CommitSource, current_roster: &Roster<'_>, extension_list: &ExtensionList, proposals: ProposalBundle, ) -> Result<ProposalBundle, Self::Error>

This is called when preparing or receiving a commit to pre-process the set of committed proposals.

Both proposals received during the current epoch and at the time of commit will be presented for validation and filtering. Filter and validate will present a raw list of proposals. Standard MLS rules are applied internally on the result of these rules.

Each member of a group MUST apply the same proposal rules in order to maintain a working group.

Typically, any invalid proposal should result in an error. The exception are invalid by-reference proposals processed when preparing a commit, which should be filtered out instead. This is to avoid the deadlock situation when no commit can be generated after receiving an invalid set of proposal messages.

ProposalBundle can be arbitrarily modified. For example, a Remove proposal that removes a moderator can result in adding a GroupContextExtensions proposal that updates the moderator list in the group context. The resulting ProposalBundle is validated by the library.

source

fn commit_options( &self, new_roster: &Roster<'_>, new_extension_list: &ExtensionList, proposals: &ProposalBundle, ) -> Result<CommitOptions, Self::Error>

This is called when preparing a commit to determine various options: whether to enforce an update path in case it is not mandated by MLS, whether to include the ratchet tree in the welcome message (if the commit adds members) and whether to generate a single welcome message, or one welcome message for each added member.

The new_roster and new_extension_list describe the group state after the commit.

source

fn encryption_options( &self, current_roster: &Roster<'_>, current_extension_list: &ExtensionList, ) -> Result<EncryptionOptions, Self::Error>

This is called when sending any packet. For proposals and commits, this determines whether to encrypt them. For any encrypted packet, this determines the padding mode used.

Note that for commits, the current_roster and current_extension_list describe the group state before the commit, unlike in commit_options.

Implementations on Foreign Types§

source§

impl<T: MlsRules + ?Sized> MlsRules for &T

§

type Error = <T as MlsRules>::Error

source§

fn filter_proposals( &self, direction: CommitDirection, source: CommitSource, current_roster: &Roster<'_>, extension_list: &ExtensionList, proposals: ProposalBundle, ) -> Result<ProposalBundle, Self::Error>

source§

fn commit_options( &self, roster: &Roster<'_>, extension_list: &ExtensionList, proposals: &ProposalBundle, ) -> Result<CommitOptions, Self::Error>

source§

fn encryption_options( &self, roster: &Roster<'_>, extension_list: &ExtensionList, ) -> Result<EncryptionOptions, Self::Error>

source§

impl<T: MlsRules + ?Sized> MlsRules for Box<T>

§

type Error = <T as MlsRules>::Error

source§

fn filter_proposals( &self, direction: CommitDirection, source: CommitSource, current_roster: &Roster<'_>, extension_list: &ExtensionList, proposals: ProposalBundle, ) -> Result<ProposalBundle, Self::Error>

source§

fn commit_options( &self, roster: &Roster<'_>, extension_list: &ExtensionList, proposals: &ProposalBundle, ) -> Result<CommitOptions, Self::Error>

source§

fn encryption_options( &self, roster: &Roster<'_>, extension_list: &ExtensionList, ) -> Result<EncryptionOptions, Self::Error>

Implementors§