Skip to content

Commit

Permalink
temporary comment for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Apr 4, 2024
1 parent fa33f5e commit 7e3c125
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
3 changes: 3 additions & 0 deletions openmls/src/group/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ pub enum ProposalValidationError {
/// See [`PskError`] for more details.
#[error(transparent)]
Psk(#[from] PskError),
/// Leaf node
#[error("something with leaf node")]
LeafNodeValidationError,
}

/// External Commit validaton error
Expand Down
70 changes: 35 additions & 35 deletions openmls/src/group/public_group/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,41 +306,41 @@ impl PublicGroup {

// If there is a required capabilities extension, check if that one
// is supported.
if let Some(required_capabilities) =
self.group_context().extensions().required_capabilities()
{
// Check if all required capabilities are supported.
capabilities
.supports_required_capabilities(required_capabilities)
.map_err(|_| ProposalValidationError::InsufficientCapabilities)?;
}

// Check that all extensions are contained in the capabilities.
if !capabilities.contain_extensions(leaf_node.extensions()) {
return Err(ProposalValidationError::InsufficientCapabilities);
}

// Check that the capabilities contain the leaf node's credential type.
if !capabilities.contains_credential(&leaf_node.credential().credential_type()) {
return Err(ProposalValidationError::InsufficientCapabilities);
}

// Check that the credential type is supported by all members of the group.
if !group_leaf_nodes.all(|node| {
node.capabilities()
.contains_credential(&leaf_node.credential().credential_type())
}) {
return Err(ProposalValidationError::InsufficientCapabilities);
}

// Check that the capabilities field of this LeafNode indicates
// support for all the credential types currently in use by other
// members.
if !group_leaf_nodes
.all(|node| capabilities.contains_credential(&node.credential().credential_type()))
{
return Err(ProposalValidationError::InsufficientCapabilities);
}
// if let Some(required_capabilities) =
// self.group_context().extensions().required_capabilities()
// {
// // Check if all required capabilities are supported.
// capabilities
// .supports_required_capabilities(required_capabilities)
// .map_err(|_| ProposalValidationError::InsufficientCapabilities)?;
// }

// // Check that all extensions are contained in the capabilities.
// if !capabilities.contain_extensions(leaf_node.extensions()) {
// return Err(ProposalValidationError::InsufficientCapabilities);
// }

// // Check that the capabilities contain the leaf node's credential type.
// if !capabilities.contains_credential(&leaf_node.credential().credential_type()) {
// return Err(ProposalValidationError::InsufficientCapabilities);
// }

// // Check that the credential type is supported by all members of the group.
// if !group_leaf_nodes.all(|node| {
// node.capabilities()
// .contains_credential(&leaf_node.credential().credential_type())
// }) {
// return Err(ProposalValidationError::InsufficientCapabilities);
// }

// // Check that the capabilities field of this LeafNode indicates
// // support for all the credential types currently in use by other
// // members.
// if !group_leaf_nodes
// .all(|node| capabilities.contains_credential(&node.credential().credential_type()))
// {
// return Err(ProposalValidationError::InsufficientCapabilities);
// }
}
Ok(())
}
Expand Down
14 changes: 7 additions & 7 deletions openmls/src/treesync/node/leaf_node/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ impl Capabilities {
required_capabilities: &RequiredCapabilitiesExtension,
) -> Result<(), LeafNodeValidationError> {
// Check if all required extensions are supported.
if required_capabilities
.extension_types()
.iter()
.any(|e| !(self.extensions().contains(e) || default_extensions().contains(e)))
{
return Err(LeafNodeValidationError::UnsupportedExtensions);
}
// if required_capabilities
// .extension_types()
// .iter()
// .any(|e| !(self.extensions().contains(e) || default_extensions().contains(e)))
// {
// return Err(LeafNodeValidationError::UnsupportedExtensions);
// }
// Check if all required proposals are supported.
if required_capabilities
.proposal_types()
Expand Down

0 comments on commit 7e3c125

Please sign in to comment.