Skip to content

Commit

Permalink
Expose full member
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhuaaa committed Nov 9, 2023
1 parent 2d4991b commit a3b9c19
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions openmls/src/group/mls_group/membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,23 @@ impl MlsGroup {
.leaf(leaf_index)
.map(|leaf| leaf.credential())
}

/// Returns the [`Member`] corresponding to the given
/// leaf index. Returns `None` if the member can not be found in this group.
pub fn member_at(&self, leaf_index: LeafNodeIndex) -> Option<Member> {
self.group
.public_group()
// This will return an error if the member can't be found.
.leaf(leaf_index)
.map(|leaf_node| {
Member::new(
leaf_index,
leaf_node.encryption_key().as_slice().to_vec(),
leaf_node.signature_key().as_slice().to_vec(),
leaf_node.credential().clone(),
)
})
}
}

/// Helper `enum` that classifies the kind of remove operation. This can be used to
Expand Down

0 comments on commit a3b9c19

Please sign in to comment.