Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions basic_credential/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ p384 = "0.13"
p521 = "0.13"
secrecy = { version = "0.8", features = ["serde"] }
rand_core = "0.6"
getrandom = { version = "0.2", features = ["js"] }
getrandom = { version = "0.3", features = ["wasm_js"] }

[dev-dependencies]
rand = "0.8"
rand = "0.9"

[features]
clonable = [] # Make the keys clonable
clonable = [] # Make the keys clonable
test-utils = [] # Only use for tests!
19 changes: 14 additions & 5 deletions openmls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ thiserror = "^1.0"
backtrace = "0.3"
hex = "0.4"
async-trait = { workspace = true }
openmls_basic_credential = { version = "0.2.0", path = "../basic_credential", features = ["clonable", "test-utils"] }
openmls_basic_credential = { version = "0.2.0", path = "../basic_credential", features = [
"clonable",
"test-utils",
] }
openmls_x509_credential = { version = "0.2.0", path = "../x509_credential" }
x509-cert = "0.2"
subtle = "2.5"
Expand All @@ -27,15 +30,19 @@ indexmap = "2.0"
itertools = "0.12"

# Only required for tests.
rand = { version = "0.8", optional = true, features = ["getrandom"] }
getrandom = { version = "0.2", optional = true, features = ["js"] }
rand = { version = "0.9", optional = true, features = ["os_rng"] }
getrandom = { version = "0.3", optional = true, features = ["wasm_js"] }
serde_json = { version = "1.0", optional = true }
# Crypto backends required for KAT and testing - "test-utils" feature
openmls_rust_crypto = { version = "0.2.0", path = "../openmls_rust_crypto", optional = true }
async-lock = { version = "3.3", optional = true }
rstest = { version = "0.18.2", optional = true }
rstest_reuse = { version = "0.6.0", optional = true }
tokio = { version = "1.24", optional = true, features = ["macros", "rt", "rt-multi-thread"] }
tokio = { version = "1.24", optional = true, features = [
"macros",
"rt",
"rt-multi-thread",
] }

[features]
default = []
Expand All @@ -59,7 +66,9 @@ backtrace = "0.3"
hex = { version = "0.4", features = ["serde"] }
lazy_static = "1.4"
openmls = { path = ".", features = ["test-utils"] }
openmls_traits = { version = "0.2.0", path = "../traits", features = ["test-utils"] }
openmls_traits = { version = "0.2.0", path = "../traits", features = [
"test-utils",
] }
pretty_env_logger = "0.5"
rstest = "0.18.2"
rstest_reuse = "0.6.0"
Expand Down
4 changes: 2 additions & 2 deletions openmls/src/binary_tree/array_representation/treemath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl LeafNodeIndex {

/// Warning: Only use when the node index represents a leaf node
pub fn from_tree_index(node_index: u32) -> Self {
debug_assert!(node_index % 2 == 0);
debug_assert!(node_index.is_multiple_of(2));
LeafNodeIndex(node_index / 2)
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@ pub enum TreeNodeIndex {
impl TreeNodeIndex {
/// Create a new `TreeNodeIndex` from a `u32`.
fn new(index: u32) -> Self {
if index % 2 == 0 {
if index.is_multiple_of(2) {
TreeNodeIndex::Leaf(LeafNodeIndex::from_tree_index(index))
} else {
TreeNodeIndex::Parent(ParentNodeIndex::from_tree_index(index))
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/core_group/create_commit_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl CreateCommitParams<'_> {
pub(crate) fn builder() -> TempBuilderCCPM0 {
TempBuilderCCPM0 {}
}
pub(crate) fn framing_parameters(&self) -> &FramingParameters {
pub(crate) fn framing_parameters(&self) -> &FramingParameters<'_> {
&self.framing_parameters
}
pub(crate) fn proposal_store(&self) -> &ProposalStore {
Expand Down
8 changes: 4 additions & 4 deletions openmls/src/group/core_group/proposals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl ProposalQueue {

/// Returns an iterator over all Add proposals in the queue
/// in the order of the the Commit message
pub fn add_proposals(&self) -> impl Iterator<Item = QueuedAddProposal> {
pub fn add_proposals(&self) -> impl Iterator<Item = QueuedAddProposal<'_>> {
self.queued_proposals().filter_map(|queued_proposal| {
if let Proposal::Add(add_proposal) = queued_proposal.proposal() {
let sender = queued_proposal.sender();
Expand All @@ -346,7 +346,7 @@ impl ProposalQueue {

/// Returns an iterator over all Remove proposals in the queue
/// in the order of the the Commit message
pub fn remove_proposals(&self) -> impl Iterator<Item = QueuedRemoveProposal> {
pub fn remove_proposals(&self) -> impl Iterator<Item = QueuedRemoveProposal<'_>> {
self.queued_proposals().filter_map(|queued_proposal| {
if let Proposal::Remove(remove_proposal) = queued_proposal.proposal() {
let sender = queued_proposal.sender();
Expand All @@ -362,7 +362,7 @@ impl ProposalQueue {

/// Returns an iterator over all Update in the queue
/// in the order of the the Commit message
pub fn update_proposals(&self) -> impl Iterator<Item = QueuedUpdateProposal> {
pub fn update_proposals(&self) -> impl Iterator<Item = QueuedUpdateProposal<'_>> {
self.queued_proposals().filter_map(|queued_proposal| {
if let Proposal::Update(update_proposal) = queued_proposal.proposal() {
let sender = queued_proposal.sender();
Expand All @@ -378,7 +378,7 @@ impl ProposalQueue {

/// Returns an iterator over all PresharedKey proposals in the queue
/// in the order of the the Commit message
pub fn psk_proposals(&self) -> impl Iterator<Item = QueuedPskProposal> {
pub fn psk_proposals(&self) -> impl Iterator<Item = QueuedPskProposal<'_>> {
self.queued_proposals().filter_map(|queued_proposal| {
if let Proposal::PreSharedKey(psk_proposal) = queued_proposal.proposal() {
let sender = queued_proposal.sender();
Expand Down
8 changes: 4 additions & 4 deletions openmls/src/group/core_group/staged_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,22 +433,22 @@ impl StagedCommit {
}

/// Returns the Add proposals that are covered by the Commit message as in iterator over [QueuedAddProposal].
pub fn add_proposals(&self) -> impl Iterator<Item = QueuedAddProposal> {
pub fn add_proposals(&self) -> impl Iterator<Item = QueuedAddProposal<'_>> {
self.staged_proposal_queue.add_proposals()
}

/// Returns the Remove proposals that are covered by the Commit message as in iterator over [QueuedRemoveProposal].
pub fn remove_proposals(&self) -> impl Iterator<Item = QueuedRemoveProposal> {
pub fn remove_proposals(&self) -> impl Iterator<Item = QueuedRemoveProposal<'_>> {
self.staged_proposal_queue.remove_proposals()
}

/// Returns the Update proposals that are covered by the Commit message as in iterator over [QueuedUpdateProposal].
pub fn update_proposals(&self) -> impl Iterator<Item = QueuedUpdateProposal> {
pub fn update_proposals(&self) -> impl Iterator<Item = QueuedUpdateProposal<'_>> {
self.staged_proposal_queue.update_proposals()
}

/// Returns the PresharedKey proposals that are covered by the Commit message as in iterator over [QueuedPskProposal].
pub fn psk_proposals(&self) -> impl Iterator<Item = QueuedPskProposal> {
pub fn psk_proposals(&self) -> impl Iterator<Item = QueuedPskProposal<'_>> {
self.staged_proposal_queue.psk_proposals()
}

Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/mls_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl MlsGroup {
}

/// Group framing parameters
pub(crate) fn framing_parameters(&self) -> FramingParameters {
pub(crate) fn framing_parameters(&self) -> FramingParameters<'_> {
FramingParameters::new(
&self.aad,
self.mls_group_config.wire_format_policy().outgoing(),
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/public_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl PublicGroup {
}

/// Create an empty [`PublicGroupDiff`] based on this [`PublicGroup`].
pub(crate) fn empty_diff(&self) -> PublicGroupDiff {
pub(crate) fn empty_diff(&self) -> PublicGroupDiff<'_> {
PublicGroupDiff::new(self)
}

Expand Down
6 changes: 3 additions & 3 deletions openmls/src/treesync/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ impl TreeSyncDiff<'_> {
&self,
node_index: TreeNodeIndex,
excluded_indices: &HashSet<&LeafNodeIndex>,
) -> Vec<(TreeNodeIndex, NodeReference)> {
) -> Vec<(TreeNodeIndex, NodeReference<'_>)> {
match node_index {
TreeNodeIndex::Leaf(leaf_index) => {
// If the node is a leaf, check if it is in the exclusion list.
Expand Down Expand Up @@ -527,7 +527,7 @@ impl TreeSyncDiff<'_> {
pub(crate) fn copath_resolutions(
&self,
leaf_index: LeafNodeIndex,
) -> Vec<Vec<(TreeNodeIndex, NodeReference)>> {
) -> Vec<Vec<(TreeNodeIndex, NodeReference<'_>)>> {
// If we're the only node in the tree, there's no copath.
if self.diff.leaf_count() == MIN_TREE_SIZE {
return vec![];
Expand All @@ -548,7 +548,7 @@ impl TreeSyncDiff<'_> {
&self,
leaf_index: LeafNodeIndex,
exclusion_list: &HashSet<&LeafNodeIndex>,
) -> Vec<Vec<(TreeNodeIndex, NodeReference)>> {
) -> Vec<Vec<(TreeNodeIndex, NodeReference<'_>)>> {
// If we're the only node in the tree, there's no copath.
if self.diff.leaf_count() == 1 {
return vec![];
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/treesync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ impl TreeSync {

/// Create an empty diff based on this [`TreeSync`] instance all operations
/// are created based on an initial, empty [`TreeSyncDiff`].
pub(crate) fn empty_diff(&self) -> TreeSyncDiff {
pub(crate) fn empty_diff(&self) -> TreeSyncDiff<'_> {
self.into()
}

Expand Down
Loading