// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // Copyright by contributors to this project. // SPDX-License-Identifier: (Apache-2.0 OR MIT)
use mls_rs_core::{crypto::SignatureSecretKey, identity::SigningIdentity};
#[must_use] /// Use external tree data if the GroupInfo message does not contain a /// [`RatchetTreeExt`](crate::extension::built_in::RatchetTreeExt) pubfn with_tree_data(self, tree_data: ExportedTree<'static>) -> Self { Self {
tree_data: Some(tree_data),
..self
}
}
#[must_use] /// Propose the removal of an old version of the client as part of the external commit. /// Only one such proposal is allowed. pubfn with_removal(self, to_remove: u32) -> Self { Self {
to_remove: Some(to_remove),
..self
}
}
#[must_use] /// Add plaintext authenticated data to the resulting commit message. pubfn with_authenticated_data(self, data: Vec<u8>) -> Self { Self {
authenticated_data: data,
..self
}
}
#[cfg(feature = "psk")] #[must_use] /// Add an external psk to the group as part of the external commit. pubfn with_external_psk(mutself, psk: ExternalPskId) -> Self { self.external_psks.push(psk); self
}
#[cfg(feature = "custom_proposal")] #[must_use] /// Insert a [`CustomProposal`] into the current commit that is being built. pubfn with_custom_proposal(mutself, proposal: CustomProposal) -> Self { self.custom_proposals.push(Proposal::Custom(proposal)); self
}
#[cfg(all(feature = "custom_proposal", feature = "by_ref_proposal"))] #[must_use] /// Insert a [`CustomProposal`] received from a current group member into the current /// commit that is being built. /// /// # Warning /// /// The authenticity of the proposal is NOT fully verified. It is only verified the /// same way as by [`ExternalGroup`](`crate::external_client::ExternalGroup`). /// The proposal MUST be an MlsPlaintext, else the [`Self::build`] function will fail. pubfn with_received_custom_proposal(mutself, proposal: MlsMessage) -> Self { self.received_custom_proposals.push(proposal); self
}
/// Build the external commit using a GroupInfo message provided by an existing group member. #[cfg_attr(not(mls_build_async), maybe_async::must_be_sync)] pubasyncfn build(self, group_info: MlsMessage) -> Result<(Group<C>, MlsMessage), MlsError> { let protocol_version = group_info.version;
if !self.config.version_supported(protocol_version) { return Err(MlsError::UnsupportedProtocolVersion(protocol_version));
}
let group_info = group_info
.into_group_info()
.ok_or(MlsError::UnexpectedMessageType)?;
let cipher_suite = cipher_suite_provider( self.config.crypto_provider(),
group_info.group_context.cipher_suite,
)?;
let external_pub_ext = group_info
.extensions
.get_as::<ExternalPubExt>()?
.ok_or(MlsError::MissingExternalPubExtension)?;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.