From 6d581636478946923ddbc8a0efd24255e3777fa5 Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Tue, 27 Jan 2026 13:25:05 +0100 Subject: [PATCH 1/3] build: upgrade rand, getrandom --- basic_credential/Cargo.toml | 6 +++--- openmls/Cargo.toml | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/basic_credential/Cargo.toml b/basic_credential/Cargo.toml index 02b2c6510e..eb313777ee 100644 --- a/basic_credential/Cargo.toml +++ b/basic_credential/Cargo.toml @@ -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! diff --git a/openmls/Cargo.toml b/openmls/Cargo.toml index 3c8cba95a0..958b3bf2ac 100644 --- a/openmls/Cargo.toml +++ b/openmls/Cargo.toml @@ -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" @@ -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 = [] @@ -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" From b7bc9a17fc507742280d5e61775ef39db734e77e Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Tue, 27 Jan 2026 13:25:55 +0100 Subject: [PATCH 2/3] chore: fix various lints --- openmls/src/group/core_group/create_commit_params.rs | 2 +- openmls/src/group/core_group/proposals.rs | 8 ++++---- openmls/src/group/core_group/staged_commit.rs | 8 ++++---- openmls/src/group/mls_group/mod.rs | 2 +- openmls/src/group/public_group/mod.rs | 2 +- openmls/src/treesync/diff.rs | 6 +++--- openmls/src/treesync/mod.rs | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openmls/src/group/core_group/create_commit_params.rs b/openmls/src/group/core_group/create_commit_params.rs index eb27cddd59..7669d3ff5f 100644 --- a/openmls/src/group/core_group/create_commit_params.rs +++ b/openmls/src/group/core_group/create_commit_params.rs @@ -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 { diff --git a/openmls/src/group/core_group/proposals.rs b/openmls/src/group/core_group/proposals.rs index f2b1f1f932..19ce8b25a5 100644 --- a/openmls/src/group/core_group/proposals.rs +++ b/openmls/src/group/core_group/proposals.rs @@ -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 { + pub fn add_proposals(&self) -> impl Iterator> { self.queued_proposals().filter_map(|queued_proposal| { if let Proposal::Add(add_proposal) = queued_proposal.proposal() { let sender = queued_proposal.sender(); @@ -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 { + pub fn remove_proposals(&self) -> impl Iterator> { self.queued_proposals().filter_map(|queued_proposal| { if let Proposal::Remove(remove_proposal) = queued_proposal.proposal() { let sender = queued_proposal.sender(); @@ -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 { + pub fn update_proposals(&self) -> impl Iterator> { self.queued_proposals().filter_map(|queued_proposal| { if let Proposal::Update(update_proposal) = queued_proposal.proposal() { let sender = queued_proposal.sender(); @@ -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 { + pub fn psk_proposals(&self) -> impl Iterator> { self.queued_proposals().filter_map(|queued_proposal| { if let Proposal::PreSharedKey(psk_proposal) = queued_proposal.proposal() { let sender = queued_proposal.sender(); diff --git a/openmls/src/group/core_group/staged_commit.rs b/openmls/src/group/core_group/staged_commit.rs index df214dc00a..f334dcaf53 100644 --- a/openmls/src/group/core_group/staged_commit.rs +++ b/openmls/src/group/core_group/staged_commit.rs @@ -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 { + pub fn add_proposals(&self) -> impl Iterator> { 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 { + pub fn remove_proposals(&self) -> impl Iterator> { 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 { + pub fn update_proposals(&self) -> impl Iterator> { 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 { + pub fn psk_proposals(&self) -> impl Iterator> { self.staged_proposal_queue.psk_proposals() } diff --git a/openmls/src/group/mls_group/mod.rs b/openmls/src/group/mls_group/mod.rs index 57e13b6d33..5d5ed2c93a 100644 --- a/openmls/src/group/mls_group/mod.rs +++ b/openmls/src/group/mls_group/mod.rs @@ -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(), diff --git a/openmls/src/group/public_group/mod.rs b/openmls/src/group/public_group/mod.rs index 02160922dd..69ca466b43 100644 --- a/openmls/src/group/public_group/mod.rs +++ b/openmls/src/group/public_group/mod.rs @@ -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) } diff --git a/openmls/src/treesync/diff.rs b/openmls/src/treesync/diff.rs index e7ce6b7a48..d8883b6f67 100644 --- a/openmls/src/treesync/diff.rs +++ b/openmls/src/treesync/diff.rs @@ -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. @@ -527,7 +527,7 @@ impl TreeSyncDiff<'_> { pub(crate) fn copath_resolutions( &self, leaf_index: LeafNodeIndex, - ) -> Vec> { + ) -> Vec)>> { // If we're the only node in the tree, there's no copath. if self.diff.leaf_count() == MIN_TREE_SIZE { return vec![]; @@ -548,7 +548,7 @@ impl TreeSyncDiff<'_> { &self, leaf_index: LeafNodeIndex, exclusion_list: &HashSet<&LeafNodeIndex>, - ) -> Vec> { + ) -> Vec)>> { // If we're the only node in the tree, there's no copath. if self.diff.leaf_count() == 1 { return vec![]; diff --git a/openmls/src/treesync/mod.rs b/openmls/src/treesync/mod.rs index 18a983c5b3..3722d4b440 100644 --- a/openmls/src/treesync/mod.rs +++ b/openmls/src/treesync/mod.rs @@ -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() } From 487934b6887f8297661e63bee45e2755ba64889c Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Tue, 27 Jan 2026 13:27:18 +0100 Subject: [PATCH 3/3] fixup! chore: fix various lints --- openmls/src/binary_tree/array_representation/treemath.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmls/src/binary_tree/array_representation/treemath.rs b/openmls/src/binary_tree/array_representation/treemath.rs index a706255c68..4f234f8d66 100644 --- a/openmls/src/binary_tree/array_representation/treemath.rs +++ b/openmls/src/binary_tree/array_representation/treemath.rs @@ -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) } } @@ -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))