diff --git a/xmtp_mls/src/client.rs b/xmtp_mls/src/client.rs index a015e5d10..09b626348 100644 --- a/xmtp_mls/src/client.rs +++ b/xmtp_mls/src/client.rs @@ -50,12 +50,12 @@ use crate::{ group_message::StoredGroupMessage, refresh_state::EntityKind, wallet_addresses::WalletEntry, + xmtp_openmls_provider::XmtpOpenMlsProvider, EncryptedMessageStore, NotFound, StorageError, }, subscriptions::{LocalEventError, LocalEvents}, types::InstallationId, verified_key_package_v2::{KeyPackageVerificationError, VerifiedKeyPackageV2}, - xmtp_openmls_provider::XmtpOpenMlsProvider, Fetch, Store, XmtpApi, }; use crate::{groups::ConversationListItem, storage::ProviderTransactions}; diff --git a/xmtp_mls/src/groups/device_sync.rs b/xmtp_mls/src/groups/device_sync.rs index 734aad132..1a7d00d2b 100644 --- a/xmtp_mls/src/groups/device_sync.rs +++ b/xmtp_mls/src/groups/device_sync.rs @@ -8,10 +8,10 @@ use crate::{ consent_record::StoredConsentRecord, group::{ConversationType, GroupQueryArgs, StoredGroup}, group_message::{GroupMessageKind, MsgQueryArgs, StoredGroupMessage}, + xmtp_openmls_provider::XmtpOpenMlsProvider, DbConnection, NotFound, StorageError, }, subscriptions::{LocalEvents, StreamMessages, SubscribeError, SyncMessage}, - xmtp_openmls_provider::XmtpOpenMlsProvider, Client, Store, }; use aes_gcm::aead::generic_array::GenericArray; diff --git a/xmtp_mls/src/groups/members.rs b/xmtp_mls/src/groups/members.rs index cfdf56e28..fca70febf 100644 --- a/xmtp_mls/src/groups/members.rs +++ b/xmtp_mls/src/groups/members.rs @@ -2,11 +2,9 @@ use xmtp_id::InboxId; use super::{validated_commit::extract_group_membership, GroupError, MlsGroup, ScopedGroupClient}; -use crate::{ - storage::{ - association_state::StoredAssociationState, - consent_record::{ConsentState, ConsentType}, - }, +use crate::storage::{ + association_state::StoredAssociationState, + consent_record::{ConsentState, ConsentType}, xmtp_openmls_provider::XmtpOpenMlsProvider, }; diff --git a/xmtp_mls/src/groups/mls_sync.rs b/xmtp_mls/src/groups/mls_sync.rs index 8f976e76b..9c22bc492 100644 --- a/xmtp_mls/src/groups/mls_sync.rs +++ b/xmtp_mls/src/groups/mls_sync.rs @@ -22,6 +22,7 @@ use crate::{ identity::{parse_credential, IdentityError}, identity_updates::load_identity_updates, intents::ProcessIntentError, + storage::xmtp_openmls_provider::XmtpOpenMlsProvider, storage::{ db_connection::DbConnection, group_intent::{IntentKind, IntentState, StoredGroupIntent, ID}, @@ -34,7 +35,6 @@ use crate::{ }, subscriptions::{LocalEvents, SyncMessage}, utils::{hash::sha256, id::calculate_message_id, time::hmac_epoch}, - xmtp_openmls_provider::XmtpOpenMlsProvider, Delete, Fetch, StoreOrIgnore, }; use futures::future::try_join_all; diff --git a/xmtp_mls/src/groups/mod.rs b/xmtp_mls/src/groups/mod.rs index 5180c8082..0b640f7e6 100644 --- a/xmtp_mls/src/groups/mod.rs +++ b/xmtp_mls/src/groups/mod.rs @@ -89,6 +89,7 @@ use crate::{ identity::{parse_credential, IdentityError}, identity_updates::{load_identity_updates, InstallationDiffError}, intents::ProcessIntentError, + storage::xmtp_openmls_provider::XmtpOpenMlsProvider, storage::{ consent_record::{ConsentState, ConsentType, StoredConsentRecord}, db_connection::DbConnection, @@ -99,7 +100,6 @@ use crate::{ }, subscriptions::{LocalEventError, LocalEvents}, utils::id::calculate_message_id, - xmtp_openmls_provider::XmtpOpenMlsProvider, Store, MLS_COMMIT_LOCK, }; use std::future::Future; @@ -1791,9 +1791,9 @@ pub(crate) mod tests { group::{ConversationType, GroupQueryArgs}, group_intent::{IntentKind, IntentState}, group_message::{GroupMessageKind, MsgQueryArgs, StoredGroupMessage}, + xmtp_openmls_provider::XmtpOpenMlsProvider, }, utils::test::FullXmtpClient, - xmtp_openmls_provider::XmtpOpenMlsProvider, InboxOwner, StreamHandle as _, }; diff --git a/xmtp_mls/src/groups/scoped_client.rs b/xmtp_mls/src/groups/scoped_client.rs index 2dea0e6e1..bc191c7b7 100644 --- a/xmtp_mls/src/groups/scoped_client.rs +++ b/xmtp_mls/src/groups/scoped_client.rs @@ -3,11 +3,13 @@ use crate::{ api::ApiClientWrapper, client::{ClientError, XmtpMlsLocalContext}, identity_updates::{InstallationDiff, InstallationDiffError}, - storage::{DbConnection, EncryptedMessageStore, StorageError}, + storage::{ + xmtp_openmls_provider::XmtpOpenMlsProvider, DbConnection, EncryptedMessageStore, + StorageError, + }, subscriptions::LocalEvents, types::InstallationId, verified_key_package_v2::VerifiedKeyPackageV2, - xmtp_openmls_provider::XmtpOpenMlsProvider, Client, }; use std::sync::Arc; diff --git a/xmtp_mls/src/hpke.rs b/xmtp_mls/src/hpke.rs index cf664043a..fa2e2bcf5 100644 --- a/xmtp_mls/src/hpke.rs +++ b/xmtp_mls/src/hpke.rs @@ -1,7 +1,9 @@ use crate::{ configuration::{CIPHERSUITE, WELCOME_HPKE_LABEL}, - storage::sql_key_store::{SqlKeyStoreError, KEY_PACKAGE_REFERENCES}, - xmtp_openmls_provider::XmtpOpenMlsProvider, + storage::{ + sql_key_store::{SqlKeyStoreError, KEY_PACKAGE_REFERENCES}, + xmtp_openmls_provider::XmtpOpenMlsProvider, + }, }; use openmls::{ ciphersuite::hash_ref::KeyPackageRef, diff --git a/xmtp_mls/src/identity.rs b/xmtp_mls/src/identity.rs index e8b904c56..4c318304e 100644 --- a/xmtp_mls/src/identity.rs +++ b/xmtp_mls/src/identity.rs @@ -7,8 +7,7 @@ use crate::storage::sql_key_store::{SqlKeyStore, SqlKeyStoreError, KEY_PACKAGE_R use crate::{ api::{ApiClientWrapper, WrappedApiError}, configuration::{CIPHERSUITE, GROUP_MEMBERSHIP_EXTENSION_ID, MUTABLE_METADATA_EXTENSION_ID}, - storage::StorageError, - xmtp_openmls_provider::XmtpOpenMlsProvider, + storage::{xmtp_openmls_provider::XmtpOpenMlsProvider, StorageError}, Fetch, Store, XmtpApi, }; use openmls::prelude::hash_ref::HashReference; diff --git a/xmtp_mls/src/lib.rs b/xmtp_mls/src/lib.rs index 164e79af6..6e0266abf 100644 --- a/xmtp_mls/src/lib.rs +++ b/xmtp_mls/src/lib.rs @@ -17,14 +17,12 @@ pub mod subscriptions; pub mod types; pub mod utils; pub mod verified_key_package_v2; -mod xmtp_openmls_provider; pub use client::{Client, Network}; use std::collections::HashMap; use std::sync::{Arc, LazyLock, Mutex}; -use storage::{DuplicateItem, StorageError}; +use storage::{xmtp_openmls_provider::XmtpOpenMlsProvider, DuplicateItem, StorageError}; use tokio::sync::{OwnedSemaphorePermit, Semaphore}; -pub use xmtp_openmls_provider::XmtpOpenMlsProvider; pub use xmtp_id::InboxOwner; pub use xmtp_proto::api_client::trait_impls::*; diff --git a/xmtp_mls/src/storage/encrypted_store/db_connection.rs b/xmtp_mls/src/storage/encrypted_store/db_connection.rs index 078892e0a..045b897a9 100644 --- a/xmtp_mls/src/storage/encrypted_store/db_connection.rs +++ b/xmtp_mls/src/storage/encrypted_store/db_connection.rs @@ -1,8 +1,9 @@ -use crate::xmtp_openmls_provider::XmtpOpenMlsProvider; use parking_lot::Mutex; use std::fmt; use std::sync::Arc; +use crate::storage::xmtp_openmls_provider::XmtpOpenMlsProvider; + #[cfg(not(target_arch = "wasm32"))] pub type DbConnection = DbConnectionPrivate; diff --git a/xmtp_mls/src/storage/encrypted_store/mod.rs b/xmtp_mls/src/storage/encrypted_store/mod.rs index aef9ca2ac..d12a42af7 100644 --- a/xmtp_mls/src/storage/encrypted_store/mod.rs +++ b/xmtp_mls/src/storage/encrypted_store/mod.rs @@ -22,7 +22,7 @@ pub mod identity_update; pub mod key_package_history; pub mod key_store_entry; #[cfg(not(target_arch = "wasm32"))] -pub mod native; +pub(super) mod native; pub mod refresh_state; pub mod schema; mod schema_gen; @@ -31,7 +31,7 @@ mod sqlcipher_connection; pub mod user_preferences; pub mod wallet_addresses; #[cfg(target_arch = "wasm32")] -pub mod wasm; +pub(super) mod wasm; pub use self::db_connection::DbConnection; #[cfg(not(target_arch = "wasm32"))] @@ -46,8 +46,8 @@ pub use self::wasm::SqliteConnection; #[cfg(target_arch = "wasm32")] pub use sqlite_web::{connection::WasmSqliteConnection as RawDbConnection, WasmSqlite as Sqlite}; -use super::StorageError; -use crate::{xmtp_openmls_provider::XmtpOpenMlsProviderPrivate, Store}; +use super::{xmtp_openmls_provider::XmtpOpenMlsProviderPrivate, StorageError}; +use crate::Store; use db_connection::DbConnectionPrivate; use diesel::{ connection::{LoadConnection, TransactionManager}, @@ -159,6 +159,8 @@ impl EncryptedMessageStore { /// Shared Code between WebAssembly and Native using the `XmtpDb` trait pub mod private { + use crate::storage::xmtp_openmls_provider::XmtpOpenMlsProviderPrivate; + use super::*; use diesel::connection::SimpleConnection; use diesel_migrations::MigrationHarness; @@ -197,7 +199,7 @@ pub mod private { &self, ) -> Result, StorageError> { let conn = self.conn()?; - Ok(crate::xmtp_openmls_provider::XmtpOpenMlsProviderPrivate::new(conn)) + Ok(XmtpOpenMlsProviderPrivate::new(conn)) } /// Pulls a new connection from the store diff --git a/xmtp_mls/src/storage/mod.rs b/xmtp_mls/src/storage/mod.rs index f8ce9357c..4cda41805 100644 --- a/xmtp_mls/src/storage/mod.rs +++ b/xmtp_mls/src/storage/mod.rs @@ -2,6 +2,7 @@ pub(super) mod encrypted_store; mod errors; pub mod serialization; pub mod sql_key_store; +pub mod xmtp_openmls_provider; pub use encrypted_store::*; pub use errors::*; diff --git a/xmtp_mls/src/storage/sql_key_store.rs b/xmtp_mls/src/storage/sql_key_store.rs index 1ad7aa674..7fc9ed1c5 100644 --- a/xmtp_mls/src/storage/sql_key_store.rs +++ b/xmtp_mls/src/storage/sql_key_store.rs @@ -1040,8 +1040,10 @@ pub(crate) mod tests { use super::SqlKeyStore; use crate::{ configuration::CIPHERSUITE, - storage::{sql_key_store::SqlKeyStoreError, EncryptedMessageStore, StorageOption}, - xmtp_openmls_provider::XmtpOpenMlsProvider, + storage::{ + sql_key_store::SqlKeyStoreError, xmtp_openmls_provider::XmtpOpenMlsProvider, + EncryptedMessageStore, StorageOption, + }, }; use xmtp_common::tmp_path; diff --git a/xmtp_mls/src/xmtp_openmls_provider.rs b/xmtp_mls/src/storage/xmtp_openmls_provider.rs similarity index 100% rename from xmtp_mls/src/xmtp_openmls_provider.rs rename to xmtp_mls/src/storage/xmtp_openmls_provider.rs