pub struct PublicGroup { /* private fields */ }Expand description
This struct holds all public values of an MLS group.
Implementations§
Source§impl PublicGroup
impl PublicGroup
Sourcepub fn process_message(
&self,
crypto: &impl OpenMlsCrypto,
message: impl Into<ProtocolMessage>,
) -> Result<ProcessedMessage, PublicProcessMessageError>
pub fn process_message( &self, crypto: &impl OpenMlsCrypto, message: impl Into<ProtocolMessage>, ) -> Result<ProcessedMessage, PublicProcessMessageError>
This function is used to parse messages from the DS. It checks for syntactic errors and does semantic validation as well. It returns a ProcessedMessage enum. Checks the following semantic validation:
- ValSem002
- ValSem003
- ValSem004
- ValSem005
- ValSem006
- ValSem007
- ValSem008
- ValSem009
- ValSem010
- ValSem101
- ValSem102
- ValSem104
- ValSem106
- ValSem107
- ValSem108
- ValSem110
- ValSem111
- ValSem112
- ValSem200
- ValSem201
- ValSem202: Path must be the right length
- ValSem203: Path secrets must decrypt correctly
- ValSem204: Public keys from Path must be verified and match the private keys from the direct path
- ValSem205
- ValSem240
- ValSem241
- ValSem242
- ValSem244
- ValSem245
- ValSem246 (as part of ValSem010)
A commit covering AppDataUpdate proposals is returned as
ProcessedMessageContent::UnresolvedAppDataCommit, since the
application has to interpret the proposals before the commit can be
staged via PublicGroup::stage_app_data_commit().
Sourcepub fn app_data_dictionary_updater(&self) -> AppDataDictionaryUpdater<'_>
Available on crate feature extensions-draft only.
pub fn app_data_dictionary_updater(&self) -> AppDataDictionaryUpdater<'_>
extensions-draft only.Returns a new helper struct for updating the app data
Sourcepub fn stage_app_data_commit(
&self,
crypto: &impl OpenMlsCrypto,
unresolved_commit: UnresolvedAppDataCommit,
app_data_dict_updates: Option<AppDataUpdates>,
) -> Result<StagedCommit, StageCommitError>
Available on crate feature extensions-draft only.
pub fn stage_app_data_commit( &self, crypto: &impl OpenMlsCrypto, unresolved_commit: UnresolvedAppDataCommit, app_data_dict_updates: Option<AppDataUpdates>, ) -> Result<StagedCommit, StageCommitError>
extensions-draft only.Stages a Commit covering AppDataUpdate proposals, after the application
has interpreted the proposals and computed the resulting
AppDataUpdates.
The returned StagedCommit can be inspected and merged into the
group’s state using PublicGroup::merge_commit().
Sourcepub fn resolve_app_data_commit(
&self,
crypto: &impl OpenMlsCrypto,
processed_message: ProcessedMessage,
app_data_dict_updates: Option<AppDataUpdates>,
) -> Result<ProcessedMessage, ResolveAppDataCommitError>
Available on crate feature extensions-draft only.
pub fn resolve_app_data_commit( &self, crypto: &impl OpenMlsCrypto, processed_message: ProcessedMessage, app_data_dict_updates: Option<AppDataUpdates>, ) -> Result<ProcessedMessage, ResolveAppDataCommitError>
extensions-draft only.Resolves a ProcessedMessage carrying an
ProcessedMessageContent::UnresolvedAppDataCommit: stages the commit
with the application-computed AppDataUpdates and returns the same
message with the resulting StagedCommit as regular
ProcessedMessageContent::StagedCommitMessage content. All other
message fields (sender, credential, authenticated data) are preserved.
Use this instead of PublicGroup::stage_app_data_commit() when the
caller needs the resolved commit in ProcessedMessage form, e.g. to
keep a single code path for commits with and without AppDataUpdate
proposals.
Returns an error if the message content is not an unresolved app data commit; the message is consumed either way.
Source§impl PublicGroup
impl PublicGroup
Sourcepub fn merge_commit<Storage: PublicStorageProvider>(
&mut self,
storage: &Storage,
staged_commit: StagedCommit,
) -> Result<(), MergeCommitError<Storage::Error>>
pub fn merge_commit<Storage: PublicStorageProvider>( &mut self, storage: &Storage, staged_commit: StagedCommit, ) -> Result<(), MergeCommitError<Storage::Error>>
Merges a StagedCommit into the public group state.
Source§impl PublicGroup
impl PublicGroup
Sourcepub fn from_external<StorageProvider, StorageError>(
crypto: &impl OpenMlsCrypto,
storage: &StorageProvider,
ratchet_tree: RatchetTreeIn,
verifiable_group_info: VerifiableGroupInfo,
proposal_store: ProposalStore,
) -> Result<(Self, GroupInfo), CreationFromExternalError<StorageError>>where
StorageProvider: PublicStorageProvider<Error = StorageError>,
pub fn from_external<StorageProvider, StorageError>(
crypto: &impl OpenMlsCrypto,
storage: &StorageProvider,
ratchet_tree: RatchetTreeIn,
verifiable_group_info: VerifiableGroupInfo,
proposal_store: ProposalStore,
) -> Result<(Self, GroupInfo), CreationFromExternalError<StorageError>>where
StorageProvider: PublicStorageProvider<Error = StorageError>,
Create a PublicGroup instance to start tracking an existing MLS group.
This function performs basic validation checks and returns an error if
one of the checks fails. See CreationFromExternalError for more
details.
Sourcepub fn ext_commit_sender_index(
&self,
commit: &StagedCommit,
) -> Result<LeafNodeIndex, LibraryError>
pub fn ext_commit_sender_index( &self, commit: &StagedCommit, ) -> Result<LeafNodeIndex, LibraryError>
Returns the index of the sender of a staged, external commit.
Sourcepub fn members(&self) -> impl Iterator<Item = Member> + '_
pub fn members(&self) -> impl Iterator<Item = Member> + '_
Get an iterator over all Members of this PublicGroup.
Sourcepub fn export_ratchet_tree(&self) -> RatchetTree
pub fn export_ratchet_tree(&self) -> RatchetTree
Export the nodes of the public tree.
Sourcepub fn add_proposal<Storage: PublicStorageProvider>(
&mut self,
storage: &Storage,
proposal: QueuedProposal,
) -> Result<(), Storage::Error>
pub fn add_proposal<Storage: PublicStorageProvider>( &mut self, storage: &Storage, proposal: QueuedProposal, ) -> Result<(), Storage::Error>
Add the QueuedProposal to the PublicGroups internal ProposalStore.
Sourcepub fn remove_proposal<Storage: PublicStorageProvider>(
&mut self,
storage: &Storage,
proposal_ref: &ProposalRef,
) -> Result<(), Storage::Error>
pub fn remove_proposal<Storage: PublicStorageProvider>( &mut self, storage: &Storage, proposal_ref: &ProposalRef, ) -> Result<(), Storage::Error>
Remove the Proposal with the given ProposalRef from the PublicGroups internal ProposalStore.
Sourcepub fn queued_proposals<Storage: PublicStorageProvider>(
&self,
storage: &Storage,
) -> Result<Vec<(ProposalRef, QueuedProposal)>, Storage::Error>
pub fn queued_proposals<Storage: PublicStorageProvider>( &self, storage: &Storage, ) -> Result<Vec<(ProposalRef, QueuedProposal)>, Storage::Error>
Return all queued proposals
Source§impl PublicGroup
impl PublicGroup
Sourcepub fn ciphersuite(&self) -> Ciphersuite
pub fn ciphersuite(&self) -> Ciphersuite
Get the ciphersuite.
Sourcepub fn version(&self) -> ProtocolVersion
pub fn version(&self) -> ProtocolVersion
Get the version.
Sourcepub fn group_context(&self) -> &GroupContext
pub fn group_context(&self) -> &GroupContext
Get the group context.
Sourcepub fn required_capabilities(&self) -> Option<&RequiredCapabilitiesExtension>
pub fn required_capabilities(&self) -> Option<&RequiredCapabilitiesExtension>
Get the required capabilities.
Sourcepub fn treesync(&self) -> &TreeSync
pub fn treesync(&self) -> &TreeSync
Returns the current tree state of the group, in the form of a TreeSync.
Sourcepub fn confirmation_tag(&self) -> &ConfirmationTag
pub fn confirmation_tag(&self) -> &ConfirmationTag
Get confirmation tag.
Sourcepub fn leaf(&self, leaf_index: LeafNodeIndex) -> Option<&LeafNode>
pub fn leaf(&self, leaf_index: LeafNodeIndex) -> Option<&LeafNode>
Return a reference to the leaf at the given LeafNodeIndex or None if the
leaf is blank.
Sourcepub fn delete<Storage: PublicStorageProvider>(
storage: &Storage,
group_id: &GroupId,
) -> Result<(), Storage::Error>
pub fn delete<Storage: PublicStorageProvider>( storage: &Storage, group_id: &GroupId, ) -> Result<(), Storage::Error>
Deletes the PublicGroup from storage.
Sourcepub fn load<Storage: PublicStorageProvider>(
storage: &Storage,
group_id: &GroupId,
) -> Result<Option<Self>, Storage::Error>
pub fn load<Storage: PublicStorageProvider>( storage: &Storage, group_id: &GroupId, ) -> Result<Option<Self>, Storage::Error>
Loads the PublicGroup corresponding to a GroupId from storage.
Trait Implementations§
Source§impl Clone for PublicGroup
Available on crate features test-utils only.
impl Clone for PublicGroup
test-utils only.Source§fn clone(&self) -> PublicGroup
fn clone(&self) -> PublicGroup
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 PublicGroup
impl Debug for PublicGroup
Source§impl<'de> Deserialize<'de> for PublicGroup
Available on crate feature migration-import only.
impl<'de> Deserialize<'de> for PublicGroup
migration-import only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for PublicGroup
Available on crate features test-utils only.
impl PartialEq for PublicGroup
test-utils only.Source§impl Serialize for PublicGroup
Available on crate features migration-import and test-utils only.
impl Serialize for PublicGroup
migration-import and test-utils only.impl StructuralPartialEq for PublicGroup
test-utils only.Auto Trait Implementations§
impl Freeze for PublicGroup
impl RefUnwindSafe for PublicGroup
impl Send for PublicGroup
impl Sync for PublicGroup
impl Unpin for PublicGroup
impl UnsafeUnpin for PublicGroup
impl UnwindSafe for PublicGroup
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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