Skip to content

Commit

Permalink
Appease rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
OtaK committed Feb 13, 2024
1 parent bf5347c commit 9b724b7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 46 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ resolver = "2"
async-trait = "0.1"

[workspace.dependencies.tls_codec]
version = "0.4.0"
version = "0.4"
features = ["derive", "serde", "mls"]

[workspace.dependencies.tls_codec_derive]
version = "0.4.0"
version = "0.4"
features = ["derive", "serde", "mls"]
2 changes: 1 addition & 1 deletion openmls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ x509-cert = "0.2"
subtle = "2.5"
fluvio-wasm-timer = "0.2"
indexmap = "2.0"
itertools = "0.11"
itertools = "0.12"

# Only required for tests.
rand = { version = "0.8", optional = true, features = ["getrandom"] }
Expand Down
46 changes: 23 additions & 23 deletions openmls/src/group/core_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl CoreGroupBuilder {
/// [`OpenMlsCryptoProvider`].
pub(crate) async fn build<KeyStore: OpenMlsKeyStore>(
self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
) -> Result<CoreGroup, CoreGroupBuildError<KeyStore::Error>> {
let (public_group_builder, commit_secret, leaf_keypair) =
Expand All @@ -270,7 +270,7 @@ impl CoreGroupBuilder {
.map_err(LibraryError::unexpected_crypto_error)?,
&serialized_group_context,
)
.map_err(LibraryError::unexpected_crypto_error)?;
.map_err(LibraryError::unexpected_crypto_error)?;

// TODO(#1357)
let resumption_psk_store = ResumptionPskStore::new(32);
Expand Down Expand Up @@ -407,7 +407,7 @@ impl CoreGroup {
self.context(),
signer,
)
.map_err(ValidationError::LibraryError)
.map_err(ValidationError::LibraryError)
}

// 11.1.4. PreSharedKey
Expand Down Expand Up @@ -437,7 +437,7 @@ impl CoreGroup {
pub(crate) fn members_support_extensions<'a>(
&self,
extensions: &Extensions,
pending_proposals: impl Iterator<Item=&'a QueuedProposal>,
pending_proposals: impl Iterator<Item = &'a QueuedProposal>,
) -> Result<(), MemberExtensionValidationError> {
let required_extension = extensions
.iter()
Expand Down Expand Up @@ -470,7 +470,7 @@ impl CoreGroup {
&self,
framing_parameters: FramingParameters,
extensions: Extensions,
pending_proposals: impl Iterator<Item=&'a QueuedProposal>,
pending_proposals: impl Iterator<Item = &'a QueuedProposal>,
signer: &impl Signer,
) -> Result<AuthenticatedContent, ProposeGroupContextExtensionError> {
// Ensure that the group supports all the extensions that are wanted.
Expand All @@ -485,7 +485,7 @@ impl CoreGroup {
self.context(),
signer,
)
.map_err(|e| e.into())
.map_err(|e| e.into())
}
/// Create a `ReInit` proposal
pub(crate) fn create_reinit_proposal(
Expand All @@ -512,7 +512,7 @@ impl CoreGroup {
self.context(),
signer,
)
.map_err(|e| e.into())
.map_err(|e| e.into())
}
// Create application message
pub(crate) fn create_application_message(
Expand Down Expand Up @@ -815,7 +815,7 @@ impl CoreGroup {
/// Returns an error if access to the key store fails.
pub(super) async fn store_epoch_keypairs<KeyStore: OpenMlsKeyStore>(
&self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
epoch_encryption_keypair: EpochEncryptionKeyPair,
) -> Result<(), KeyStore::Error> {
let k = EpochKeypairId::new(
Expand All @@ -835,7 +835,7 @@ impl CoreGroup {
/// Returns `None` if access to the key store fails.
pub(super) async fn read_epoch_keypairs<KeyStore: OpenMlsKeyStore>(
&self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
) -> EpochEncryptionKeyPair {
let k = EpochKeypairId::new(
self.group_id(),
Expand All @@ -855,7 +855,7 @@ impl CoreGroup {
/// Returns an error if access to the key store fails.
pub(super) async fn delete_previous_epoch_keypairs<KeyStore: OpenMlsKeyStore>(
&self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
) -> Result<(), KeyStore::Error> {
let k = EpochKeypairId::new(
self.group_id(),
Expand All @@ -871,7 +871,7 @@ impl CoreGroup {
pub(crate) async fn create_commit<KeyStore: OpenMlsKeyStore>(
&self,
mut params: CreateCommitParams<'_>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
signer: &impl Signer,
) -> Result<CreateCommitResult, CreateCommitError<KeyStore::Error>> {
let ciphersuite = self.ciphersuite();
Expand All @@ -890,15 +890,15 @@ impl CoreGroup {
params.inline_proposals(),
self.own_leaf_index(),
)
.map_err(|e| match e {
crate::group::errors::ProposalQueueError::LibraryError(e) => e.into(),
crate::group::errors::ProposalQueueError::ProposalNotFound => {
CreateCommitError::MissingProposal
}
crate::group::errors::ProposalQueueError::SenderError(_) => {
CreateCommitError::WrongProposalSenderType
}
})?;
.map_err(|e| match e {
crate::group::errors::ProposalQueueError::LibraryError(e) => e.into(),
crate::group::errors::ProposalQueueError::ProposalNotFound => {
CreateCommitError::MissingProposal
}
crate::group::errors::ProposalQueueError::SenderError(_) => {
CreateCommitError::WrongProposalSenderType
}
})?;

// TODO: #581 Filter proposals by support
// 11.2:
Expand Down Expand Up @@ -1028,7 +1028,7 @@ impl CoreGroup {
self.group_epoch_secrets().init_secret(),
&serialized_provisional_group_context,
)
.map_err(LibraryError::unexpected_crypto_error)?;
.map_err(LibraryError::unexpected_crypto_error)?;

// Prepare the PskSecret
let psk_secret = {
Expand All @@ -1037,7 +1037,7 @@ impl CoreGroup {
&self.resumption_psk_store,
&apply_proposals_values.presharedkeys,
)
.await?;
.await?;

PskSecret::new(backend, ciphersuite, psks).await?
};
Expand Down Expand Up @@ -1191,7 +1191,7 @@ impl MlsGroup {
/// re-export
pub async fn delete_previous_epoch_keypairs<KeyStore: OpenMlsKeyStore>(
&self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
) -> Result<(), KeyStore::Error> {
self.group.delete_previous_epoch_keypairs(backend).await
}
Expand Down
35 changes: 20 additions & 15 deletions openmls/src/group/core_group/staged_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ impl CoreGroup {
&init_secret,
serialized_provisional_group_context,
)
.map_err(LibraryError::unexpected_crypto_error)?
.map_err(LibraryError::unexpected_crypto_error)?
} else {
JoinerSecret::new(
backend,
commit_secret,
epoch_secrets.init_secret(),
serialized_provisional_group_context,
)
.map_err(LibraryError::unexpected_crypto_error)?
.map_err(LibraryError::unexpected_crypto_error)?
};

// Prepare the PskSecret
Expand All @@ -61,7 +61,7 @@ impl CoreGroup {
&self.resumption_psk_store,
&apply_proposals_values.presharedkeys,
)
.await?;
.await?;

PskSecret::new(backend, self.ciphersuite(), psks).await?
};
Expand Down Expand Up @@ -201,7 +201,12 @@ impl CoreGroup {
let update_path_leaf_node = Some(path.leaf_node().clone());
debug_assert_eq!(diff.leaf(sender_index), path.leaf_node().into());

(commit_secret, new_keypairs, new_leaf_keypair_option, update_path_leaf_node)
(
commit_secret,
new_keypairs,
new_leaf_keypair_option,
update_path_leaf_node,
)
} else {
if apply_proposals_values.path_required {
// ValSem201
Expand Down Expand Up @@ -285,7 +290,7 @@ impl CoreGroup {
/// might throw a `LibraryError`.
pub(crate) async fn merge_commit<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
staged_commit: StagedCommit,
) -> Result<Option<MessageSecrets>, MergeCommitError<KeyStore::Error>> {
// Get all keypairs from the old epoch, so we can later store the ones
Expand All @@ -309,7 +314,7 @@ impl CoreGroup {

async fn merge_member_commit<KeyStore: OpenMlsKeyStore>(
&mut self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider=KeyStore>,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
mut old_epoch_keypairs: EpochEncryptionKeyPair,
mut state: Box<MemberStagedCommitState>,
is_member: bool,
Expand Down Expand Up @@ -352,7 +357,7 @@ impl CoreGroup {
return Err(LibraryError::custom(
"We should have all the private key material we need.",
)
.into());
.into());
}

// Store the relevant keys under the new epoch
Expand Down Expand Up @@ -399,7 +404,7 @@ impl CoreGroup {
leaf_node_keypairs,
backend,
)
.await
.await
}
}

Expand Down Expand Up @@ -428,27 +433,27 @@ 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()
}

/// Returns an interator over all [`QueuedProposal`]s
pub fn queued_proposals(&self) -> impl Iterator<Item=&QueuedProposal> {
pub fn queued_proposals(&self) -> impl Iterator<Item = &QueuedProposal> {
self.staged_proposal_queue.queued_proposals()
}

Expand Down Expand Up @@ -479,12 +484,12 @@ impl StagedCommit {
}
}


/// Returns the leaf node of the (optional) update path.
pub fn get_update_path_leaf_node(&self) -> Option<&LeafNode> {
match self.state {
StagedCommitState::PublicState(_) => None,
StagedCommitState::GroupMember(ref member) | StagedCommitState::ExternalMember(ref member) => {
StagedCommitState::GroupMember(ref member)
| StagedCommitState::ExternalMember(ref member) => {
member.update_path_leaf_node.as_ref()
}
}
Expand Down
4 changes: 2 additions & 2 deletions openmls/src/key_packages/key_package_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mod private_mod {
/// } KeyPackageTBS;
/// ```
#[derive(
Debug, Clone, PartialEq, TlsSize, TlsSerialize, TlsDeserialize, Serialize, Deserialize,
Debug, Clone, PartialEq, TlsSize, TlsSerialize, TlsDeserialize, Serialize, Deserialize,
)]
struct KeyPackageTbsIn {
protocol_version: ProtocolVersion,
Expand All @@ -86,7 +86,7 @@ struct KeyPackageTbsIn {

/// The key package struct.
#[derive(
Debug, PartialEq, Clone, Serialize, Deserialize, TlsSerialize, TlsDeserialize, TlsSize,
Debug, PartialEq, Clone, Serialize, Deserialize, TlsSerialize, TlsDeserialize, TlsSize,
)]
pub struct KeyPackageIn {
payload: KeyPackageTbsIn,
Expand Down
4 changes: 1 addition & 3 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
wrap_comments = true
edition = "2018"
format_code_in_doc_comments = true
edition = "2021"

0 comments on commit 9b724b7

Please sign in to comment.