Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update core-crypto repo to rust 2024 edition [WPB-16113] #925

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
128 changes: 93 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crypto-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "core-crypto-ffi"
description = "Platform-specific bindings (Android, iOS, WASM) for CoreCrypto"
repository = "https://github.com/wireapp/core-crypto"
version = "4.1.0"
edition = "2021"
edition = "2024"
license = "GPL-3.0-only"
publish = false

Expand Down
8 changes: 4 additions & 4 deletions crypto-ffi/src/generic/context/e2ei.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::{collections::HashMap, ops::DerefMut};

use crate::{
CoreCryptoError, NewCrlDistributionPoints,
generic::{
context::CoreCryptoContext, Ciphersuite, ClientId, CoreCryptoResult, CrlRegistration, E2eiConversationState,
E2eiDumpedPkiEnv, E2eiEnrollment, MlsCredentialType, WireIdentity,
Ciphersuite, ClientId, CoreCryptoResult, CrlRegistration, E2eiConversationState, E2eiDumpedPkiEnv,
E2eiEnrollment, MlsCredentialType, WireIdentity, context::CoreCryptoContext,
},
CoreCryptoError, NewCrlDistributionPoints,
};
use core_crypto::{prelude::VerifiableGroupInfo, RecursiveError};
use core_crypto::{RecursiveError, prelude::VerifiableGroupInfo};
use tls_codec::Deserialize;

#[uniffi::export]
Expand Down
2 changes: 1 addition & 1 deletion crypto-ffi/src/generic/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use super::{
use crate::NewCrlDistributionPoints;
use async_lock::{Mutex, OnceCell};
use core_crypto::{
RecursiveError,
context::CentralContext,
prelude::{
ClientIdentifier, ConversationId, KeyPackageIn, KeyPackageRef, MlsConversationConfiguration,
VerifiableGroupInfo,
},
RecursiveError,
};
use std::{future::Future, ops::Deref, sync::Arc};
use tls_codec::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion crypto-ffi/src/generic/context/proteus.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ProteusAutoPrekeyBundle;
use crate::context::CoreCryptoContext;
use crate::generic::CoreCryptoResult;
use crate::proteus_impl;
use crate::ProteusAutoPrekeyBundle;

#[uniffi::export]
impl CoreCryptoContext {
Expand Down
31 changes: 17 additions & 14 deletions crypto-ffi/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ use std::{
};

use log::{
kv::{self, Key, Value, VisitSource},
Level, LevelFilter, Metadata, Record,
kv::{self, Key, Value, VisitSource},
};
use log_reload::ReloadLog;
use tls_codec::Deserialize;

use self::context::CoreCryptoContext;
use crate::{proteus_impl, UniffiCustomTypeConverter};
use crate::{UniffiCustomTypeConverter, proteus_impl};
pub use core_crypto::prelude::ConversationId;
use core_crypto::{
InnermostErrorMessage, RecursiveError,
prelude::{
EntropySeed, MlsBufferedConversationDecryptMessage, MlsCentral, MlsCentralConfiguration, MlsCiphersuite,
MlsCommitBundle, MlsConversationDecryptMessage, MlsCustomConfiguration, MlsGroupInfoBundle, MlsProposalBundle,
VerifiableGroupInfo,
},
InnermostErrorMessage, RecursiveError,
};

pub mod context;
Expand Down Expand Up @@ -97,7 +97,9 @@ pub enum MlsError {
BufferedFutureMessage,
#[error("Incoming message is from an epoch too far in the future to buffer.")]
WrongEpoch,
#[error("Incoming message is a commit for which we have not yet received all the proposals. Buffering until all proposals have arrived.")]
#[error(
"Incoming message is a commit for which we have not yet received all the proposals. Buffering until all proposals have arrived."
)]
BufferedCommit,
#[error("The epoch in which message was encrypted is older than allowed")]
MessageEpochTooOld,
Expand All @@ -115,7 +117,9 @@ pub enum MlsError {
/// requests their old KeyPackages to be deleted but one has already been claimed by another client to create a Welcome.
/// In that case the only solution is that the client receiving such a Welcome tries to join the group
/// with an External Commit instead
#[error("Although this Welcome seems valid, the local KeyPackage it references has already been deleted locally. Join this group with an external commit")]
#[error(
"Although this Welcome seems valid, the local KeyPackage it references has already been deleted locally. Join this group with an external commit"
)]
OrphanWelcome,
/// Message rejected by the delivery service
#[error("Message rejected by the delivery service. Reason: {reason}")]
Expand Down Expand Up @@ -695,15 +699,14 @@ impl TryFrom<MlsConversationDecryptMessage> for DecryptedMessage {
.map(ProposalBundle::try_from)
.collect::<CoreCryptoResult<Vec<_>>>()?;

let buffered_messages = if let Some(bm) = from.buffered_messages {
let bm = bm
.into_iter()
.map(TryInto::try_into)
.collect::<CoreCryptoResult<Vec<_>>>()?;
Some(bm)
} else {
None
};
let buffered_messages = from
.buffered_messages
.map(|bm| {
bm.into_iter()
.map(TryInto::try_into)
.collect::<CoreCryptoResult<Vec<_>>>()
})
.transpose()?;

Ok(Self {
message: from.app_msg,
Expand Down
Loading
Loading