diff --git a/Cargo.lock b/Cargo.lock index 5a1c753..20f7ed0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -278,8 +278,8 @@ dependencies = [ "arboard", "base64", "clap", - "client", "crossterm 0.29.0", + "logos-chat", "ratatui", "serde", "serde_json", @@ -359,23 +359,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" -[[package]] -name = "client" -version = "0.1.0" -dependencies = [ - "chat-sqlite", - "components", - "libchat", - "tempfile", - "thiserror", -] - [[package]] name = "client-ffi" version = "0.1.0" dependencies = [ - "client", "libchat", + "logos-chat", "safer-ffi", ] @@ -1744,6 +1733,17 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "logos-chat" +version = "0.1.0" +dependencies = [ + "chat-sqlite", + "components", + "libchat", + "tempfile", + "thiserror", +] + [[package]] name = "lru" version = "0.12.5" diff --git a/Cargo.toml b/Cargo.toml index 3d6a969..c1a2ee1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,15 +3,15 @@ resolver = "3" members = [ - "core/sqlite", + "bin/chat-cli", "core/conversations", "core/crypto", "core/double-ratchets", - "core/storage", "core/integration_tests_core", - "crates/client", + "core/sqlite", + "core/storage", "crates/client-ffi", - "bin/chat-cli", + "crates/client", "extensions/components", ] @@ -27,12 +27,16 @@ default-members = [ ] [workspace.dependencies] - blake2 = "0.10" - crypto = { path = "core/crypto" } - libchat = { path = "core/conversations" } - logoschat_components = {package="components", path ="extensions/components"} - sqlite = { path = "core/sqlite"} - storage = { path = "core/storage" } +# Internal Workspace dependency declarations (sorted) +chat-sqlite = { path = "core/sqlite" } +components = { path = "extensions/components" } +crypto = { path = "core/crypto" } +libchat = { path = "core/conversations" } +logos-chat = { path = "crates/client" } +storage = { path = "core/storage" } + +# External Workspace dependency declarations (sorted) +blake2 = "0.10" # Panicking across FFI boundaries is UB; abort is the correct strategy for a # C FFI library. diff --git a/bin/chat-cli/Cargo.toml b/bin/chat-cli/Cargo.toml index a4535d2..5cc57b8 100644 --- a/bin/chat-cli/Cargo.toml +++ b/bin/chat-cli/Cargo.toml @@ -8,16 +8,19 @@ name = "chat-cli" path = "src/main.rs" [dependencies] -# Reference a specific commit so updates to the Core does not break examples -client = { path = "../../crates/client" } -ratatui = "0.29" -crossterm = "0.29" -clap = { version = "4", features = ["derive"] } +# Workspace dependencies (sorted) +logos-chat = { workspace = true } + +# External dependencies (sorted) anyhow = "1.0" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" arboard = "3" base64 = "0.22" +clap = { version = "4", features = ["derive"] } + +crossterm = "0.29" +ratatui = "0.29" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" thiserror = "2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/bin/chat-cli/src/app.rs b/bin/chat-cli/src/app.rs index d8910ff..de9e47b 100644 --- a/bin/chat-cli/src/app.rs +++ b/bin/chat-cli/src/app.rs @@ -5,7 +5,7 @@ use std::sync::mpsc; use anyhow::Result; use arboard::Clipboard; -use client::{ConversationIdOwned, DeliveryService}; +use logos_chat::{ChatClient, ConversationIdOwned, DeliveryService}; use serde::{Deserialize, Serialize}; use crate::utils::now; @@ -42,7 +42,7 @@ pub struct AppState { } pub struct ChatApp { - pub client: client::ChatClient, + pub client: ChatClient, inbound: mpsc::Receiver>, pub state: AppState, /// Ephemeral command output — not persisted, cleared on chat switch. @@ -55,7 +55,7 @@ pub struct ChatApp { impl ChatApp { pub fn new( - client: client::ChatClient, + client: ChatClient, inbound: mpsc::Receiver>, user_name: &str, data_dir: &Path, diff --git a/bin/chat-cli/src/main.rs b/bin/chat-cli/src/main.rs index 3facd6a..366b100 100644 --- a/bin/chat-cli/src/main.rs +++ b/bin/chat-cli/src/main.rs @@ -8,7 +8,7 @@ use std::sync::mpsc; use anyhow::{Context, Result}; use clap::{Parser, ValueEnum}; -use client::DeliveryService; +use logos_chat::DeliveryService; use app::ChatApp; @@ -105,9 +105,9 @@ fn run( .context("db path contains non-UTF-8 characters")? .to_string(); - let client = client::ChatClient::open( + let client = logos_chat::ChatClient::open( cli.name.clone(), - client::StorageConfig::Encrypted { + logos_chat::StorageConfig::Encrypted { path: db_str, key: "chat-cli".to_string(), }, @@ -160,9 +160,9 @@ fn run_logos_delivery(cli: Cli) -> Result<()> { .to_str() .context("db path contains non-UTF-8 characters")? .to_string(); - client::ChatClient::open( + logos_chat::ChatClient::open( cli.name.clone(), - client::StorageConfig::Encrypted { + logos_chat::StorageConfig::Encrypted { path: db_str, key: "chat-cli".to_string(), }, @@ -171,7 +171,7 @@ fn run_logos_delivery(cli: Cli) -> Result<()> { .map_err(|e| anyhow::anyhow!("{e:?}")) .context("failed to open persistent client")? } - None => client::ChatClient::new(cli.name.clone(), delivery), + None => logos_chat::ChatClient::new(cli.name.clone(), delivery), }; let mut app = ChatApp::new(client, inbound, &cli.name, &data_dir)?; diff --git a/bin/chat-cli/src/transport/file.rs b/bin/chat-cli/src/transport/file.rs index 8b189ac..097af47 100644 --- a/bin/chat-cli/src/transport/file.rs +++ b/bin/chat-cli/src/transport/file.rs @@ -6,7 +6,7 @@ use std::sync::mpsc; use std::thread; use std::time::{Duration, SystemTime, UNIX_EPOCH}; -use client::{AddressedEnvelope, DeliveryService}; +use logos_chat::{AddressedEnvelope, DeliveryService}; #[derive(Debug, thiserror::Error)] pub enum FileTransportError { diff --git a/bin/chat-cli/src/transport/logos_delivery.rs b/bin/chat-cli/src/transport/logos_delivery.rs index d08af2b..1b6dce4 100644 --- a/bin/chat-cli/src/transport/logos_delivery.rs +++ b/bin/chat-cli/src/transport/logos_delivery.rs @@ -18,7 +18,7 @@ use std::time::Duration; use base64::Engine; use base64::engine::general_purpose::STANDARD as BASE64; -use client::{AddressedEnvelope, DeliveryService}; +use logos_chat::{AddressedEnvelope, DeliveryService}; use tracing::{error, info, warn}; use wrapper::LogosNodeCtx; diff --git a/bin/chat-cli/src/ui.rs b/bin/chat-cli/src/ui.rs index 4b5317b..b17d869 100644 --- a/bin/chat-cli/src/ui.rs +++ b/bin/chat-cli/src/ui.rs @@ -16,7 +16,7 @@ use ratatui::{ widgets::{Block, Borders, List, ListItem, Paragraph, Wrap}, }; -use client::DeliveryService; +use logos_chat::DeliveryService; use crate::app::ChatApp; diff --git a/core/conversations/Cargo.toml b/core/conversations/Cargo.toml index 512cfa6..eff4823 100644 --- a/core/conversations/Cargo.toml +++ b/core/conversations/Cargo.toml @@ -7,23 +7,29 @@ edition = "2024" crate-type = ["rlib","staticlib"] [dependencies] +# Workspace dependencies (sorted) +blake2 = { workspace = true } +chat-sqlite = { workspace = true } +crypto = { workspace = true } +storage = { workspace = true } + +# External dependencies (sorted) base64 = "0.22" -sqlite = { package = "chat-sqlite", path = "../sqlite" } -blake2.workspace = true chat-proto = { git = "https://github.com/logos-messaging/chat_proto" } -crypto = { path = "../crypto" } double-ratchets = { path = "../double-ratchets" } hex = "0.4.3" +openmls = { version = "0.8.1", features = ["libcrux-provider"] } +openmls_libcrux_crypto = "0.3.1" +openmls_traits = "0.5.0" prost = "0.14.1" rand_core = { version = "0.6" } safer-ffi = "0.1.13" thiserror = "2.0.17" x25519-dalek = { version = "2.0.1", features = ["static_secrets", "reusable_secrets", "getrandom"] } -storage = { path = "../storage" } -openmls = { version = "0.8.1", features = ["libcrux-provider"] } -openmls_libcrux_crypto = "0.3.1" -openmls_traits = "0.5.0" [dev-dependencies] -components = { package = "components", path = "../../extensions/components" } +# Workspace dependencies (sorted) +components = { workspace = true } + +# External dependencies (sorted) tempfile = "3" diff --git a/core/conversations/src/conversation/privatev1.rs b/core/conversations/src/conversation/privatev1.rs index b7736d8..f4f39e5 100644 --- a/core/conversations/src/conversation/privatev1.rs +++ b/core/conversations/src/conversation/privatev1.rs @@ -281,8 +281,8 @@ impl Debug for PrivateV1Convo { #[cfg(test)] mod tests { + use chat_sqlite::{ChatStorage, StorageConfig}; use crypto::PrivateKey; - use sqlite::{ChatStorage, StorageConfig}; use super::*; diff --git a/core/conversations/src/inbox/handler.rs b/core/conversations/src/inbox/handler.rs index 9b90ac3..ca02240 100644 --- a/core/conversations/src/inbox/handler.rs +++ b/core/conversations/src/inbox/handler.rs @@ -260,7 +260,7 @@ mod tests { use std::cell::RefCell; use super::*; - use sqlite::{ChatStorage, StorageConfig}; + use chat_sqlite::{ChatStorage, StorageConfig}; #[test] fn test_invite_privatev1_roundtrip() { diff --git a/core/conversations/src/lib.rs b/core/conversations/src/lib.rs index 4f855f6..b48e521 100644 --- a/core/conversations/src/lib.rs +++ b/core/conversations/src/lib.rs @@ -11,11 +11,11 @@ mod types; mod utils; pub use account::LogosAccount; +pub use chat_sqlite::ChatStorage; +pub use chat_sqlite::StorageConfig; pub use context::{Context, ConversationId, ConversationIdOwned, Introduction}; pub use conversation::GroupConvo; pub use errors::ChatError; pub use service_traits::{DeliveryService, RegistrationService}; -pub use sqlite::ChatStorage; -pub use sqlite::StorageConfig; pub use types::{AccountId, AddressedEnvelope, ContentData}; pub use utils::hex_trunc; diff --git a/core/crypto/Cargo.toml b/core/crypto/Cargo.toml index 04100aa..91df0f9 100644 --- a/core/crypto/Cargo.toml +++ b/core/crypto/Cargo.toml @@ -4,12 +4,13 @@ version = "0.1.0" edition = "2024" [dependencies] -x25519-dalek = { version = "2.0.1", features = ["static_secrets"] } -hkdf = "0.12" -sha2 = "0.10" -rand_core = { version = "0.6", features = ["getrandom"] } +# External dependencies (sorted) ed25519-dalek = { version = "2.2.0", features = ["rand_core"] } -xeddsa = "1.0.2" -zeroize = {version = "1.8.2", features= ["derive"]} generic-array = "1.3.5" +hkdf = "0.12" +rand_core = { version = "0.6", features = ["getrandom"] } +sha2 = "0.10" thiserror = "2" +x25519-dalek = { version = "2.0.1", features = ["static_secrets"] } +xeddsa = "1.0.2" +zeroize = { version = "1.8.2", features = ["derive"] } diff --git a/core/double-ratchets/Cargo.toml b/core/double-ratchets/Cargo.toml index 4d9ea08..ded93b4 100644 --- a/core/double-ratchets/Cargo.toml +++ b/core/double-ratchets/Cargo.toml @@ -7,17 +7,23 @@ edition = "2024" crate-type = ["rlib", "cdylib"] [dependencies] -x25519-dalek = { version="2.0.1", features=["static_secrets"] } -chacha20poly1305 = "0.10.1" -rand_core = "0.6.4" -rand = "0.9.3" -hkdf = "0.12.4" -thiserror = "2" -blake2 = "0.10.6" -zeroize = "1.8.2" +# Workspace dependencies (sorted) storage = { workspace = true } + +# External dependencies (sorted) +blake2 = "0.10.6" +chacha20poly1305 = "0.10.1" +hkdf = "0.12.4" +rand = "0.9.3" +rand_core = "0.6.4" serde = "1.0" +thiserror = "2" +x25519-dalek = { version = "2.0.1", features = ["static_secrets"] } +zeroize = "1.8.2" [dev-dependencies] -sqlite = { package = "chat-sqlite", path = "../sqlite" } +# Workspace dependencies (sorted) +chat-sqlite = { workspace = true } + +# External dependencies (sorted) tempfile = "3" diff --git a/core/double-ratchets/examples/out_of_order_demo.rs b/core/double-ratchets/examples/out_of_order_demo.rs index b01de57..beef652 100644 --- a/core/double-ratchets/examples/out_of_order_demo.rs +++ b/core/double-ratchets/examples/out_of_order_demo.rs @@ -2,8 +2,8 @@ //! //! Run with: cargo run --example out_of_order_demo -p double-ratchets +use chat_sqlite::{ChatStorage, StorageConfig}; use double_ratchets::{InstallationKeyPair, RatchetSession}; -use sqlite::{ChatStorage, StorageConfig}; use tempfile::NamedTempFile; fn main() { diff --git a/core/double-ratchets/examples/storage_demo.rs b/core/double-ratchets/examples/storage_demo.rs index 258d655..5222538 100644 --- a/core/double-ratchets/examples/storage_demo.rs +++ b/core/double-ratchets/examples/storage_demo.rs @@ -2,8 +2,8 @@ //! //! Run with: cargo run --example storage_demo -p double-ratchets +use chat_sqlite::{ChatStorage, StorageConfig}; use double_ratchets::{InstallationKeyPair, RatchetSession}; -use sqlite::{ChatStorage, StorageConfig}; use tempfile::NamedTempFile; fn main() { diff --git a/core/double-ratchets/src/storage/session.rs b/core/double-ratchets/src/storage/session.rs index 069ba4d..99ea7f5 100644 --- a/core/double-ratchets/src/storage/session.rs +++ b/core/double-ratchets/src/storage/session.rs @@ -168,7 +168,7 @@ fn save_state( mod tests { use super::*; use crate::hkdf::DefaultDomain; - use sqlite::ChatStorage; + use chat_sqlite::ChatStorage; fn create_test_storage() -> ChatStorage { ChatStorage::in_memory() diff --git a/core/integration_tests_core/Cargo.toml b/core/integration_tests_core/Cargo.toml index 34ff420..dec26c4 100644 --- a/core/integration_tests_core/Cargo.toml +++ b/core/integration_tests_core/Cargo.toml @@ -7,9 +7,11 @@ edition = "2024" # name = "integration_tests_core" [dev-dependencies] +# Workspace dependencies (sorted) +components = { workspace = true } libchat = { workspace = true } +chat-sqlite = { workspace = true } storage = { workspace = true } -sqlite = {package = "chat-sqlite", path ="../sqlite"} -components = { path = "../../extensions/components" } +# External dependencies (sorted) tempfile = "3" diff --git a/core/integration_tests_core/tests/private_integration.rs b/core/integration_tests_core/tests/private_integration.rs index 90d2a9b..165ba76 100644 --- a/core/integration_tests_core/tests/private_integration.rs +++ b/core/integration_tests_core/tests/private_integration.rs @@ -1,5 +1,5 @@ +use chat_sqlite::{ChatStorage, StorageConfig}; use libchat::{Context, Introduction}; -use sqlite::{ChatStorage, StorageConfig}; use storage::{ConversationStore, IdentityStore}; use tempfile::tempdir; diff --git a/core/sqlite/Cargo.toml b/core/sqlite/Cargo.toml index bd0e3ee..4fabf33 100644 --- a/core/sqlite/Cargo.toml +++ b/core/sqlite/Cargo.toml @@ -5,11 +5,15 @@ edition = "2024" description = "SQLite storage implementation for libchat" [dependencies] -crypto = { path = "../crypto" } +# Workspace dependencies (sorted) +crypto = { workspace = true } +storage = { workspace = true } + +# External dependencies (sorted) hex = "0.4.3" -storage = { path = "../storage" } -zeroize = { version = "1.8.2", features = ["derive"] } rusqlite = { version = "0.35", features = ["bundled-sqlcipher-vendored-openssl"] } +zeroize = { version = "1.8.2", features = ["derive"] } [dev-dependencies] +# External dependencies (sorted) tempfile = "3" diff --git a/core/storage/Cargo.toml b/core/storage/Cargo.toml index b176087..0c0775c 100644 --- a/core/storage/Cargo.toml +++ b/core/storage/Cargo.toml @@ -5,5 +5,8 @@ edition = "2024" description = "Shared storage layer for libchat" [dependencies] -crypto = { path = "../crypto" } +# Workspace dependencies (sorted) +crypto = { workspace = true } + +# External dependencies (sorted) thiserror = "2" diff --git a/crates/client-ffi/Cargo.toml b/crates/client-ffi/Cargo.toml index 43d8014..9752f57 100644 --- a/crates/client-ffi/Cargo.toml +++ b/crates/client-ffi/Cargo.toml @@ -11,9 +11,12 @@ name = "generate-headers" required-features = ["headers"] [dependencies] -safer-ffi = "0.1.13" -client = { path = "../client" } +# Workspace dependencies (sorted) libchat = { workspace = true } +logos-chat = { workspace = true } + +# External dependencies (sorted) +safer-ffi = "0.1.13" [features] headers = ["safer-ffi/headers"] diff --git a/crates/client-ffi/src/api.rs b/crates/client-ffi/src/api.rs index d28d538..d08eab5 100644 --- a/crates/client-ffi/src/api.rs +++ b/crates/client-ffi/src/api.rs @@ -2,7 +2,7 @@ use safer_ffi::prelude::*; use std::sync::Arc; use crate::delivery::{CDelivery, DeliverFn}; -use client::{ChatClient, ClientError}; +use logos_chat::{ChatClient, ClientError}; // --------------------------------------------------------------------------- // Opaque client handle @@ -205,7 +205,7 @@ fn client_send_message( Ok(s) => s, Err(_) => return ErrorCode::BadUtf8, }; - let convo_id_owned: client::ConversationIdOwned = Arc::from(id_str); + let convo_id_owned: logos_chat::ConversationIdOwned = Arc::from(id_str); match handle.0.send_message(&convo_id_owned, content.as_slice()) { Ok(()) => ErrorCode::None, Err(ClientError::Delivery(_)) => ErrorCode::DeliveryFail, diff --git a/crates/client-ffi/src/delivery.rs b/crates/client-ffi/src/delivery.rs index 26f8c4c..6b4d70e 100644 --- a/crates/client-ffi/src/delivery.rs +++ b/crates/client-ffi/src/delivery.rs @@ -1,5 +1,5 @@ -use client::DeliveryService; use libchat::AddressedEnvelope; +use logos_chat::DeliveryService; /// C callback invoked for each outbound envelope. Return 0 or positive on success, negative on /// error. `addr_ptr/addr_len` is the delivery address; `data_ptr/data_len` is the encrypted diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 7bec801..3b61d95 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "client" +name = "logos-chat" version = "0.1.0" edition = "2024" @@ -7,10 +7,14 @@ edition = "2024" crate-type = ["rlib"] [dependencies] +# Workspace dependencies (sorted) +chat-sqlite = { workspace = true } +components = { workspace = true} libchat = { workspace = true } -logoschat_components = { workspace = true} -chat-sqlite = { path = "../../core/sqlite" } + +# External dependencies (sorted) thiserror = "2" [dev-dependencies] +# External dependencies (sorted) tempfile = "3" diff --git a/crates/client/examples/message-exchange/main.rs b/crates/client/examples/message-exchange/main.rs index 8451223..2698290 100644 --- a/crates/client/examples/message-exchange/main.rs +++ b/crates/client/examples/message-exchange/main.rs @@ -1,4 +1,4 @@ -use client::{ChatClient, ConversationIdOwned, InProcessDelivery}; +use logos_chat::{ChatClient, ConversationIdOwned, InProcessDelivery}; use std::sync::Arc; fn main() { diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index d9475d7..95a36af 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -3,7 +3,7 @@ use libchat::{ DeliveryService, Introduction, StorageConfig, }; -use logoschat_components::EphemeralRegistry; +use components::EphemeralRegistry; use crate::errors::ClientError; diff --git a/crates/client/tests/saro_and_raya.rs b/crates/client/tests/saro_and_raya.rs index 9429270..4aba9a7 100644 --- a/crates/client/tests/saro_and_raya.rs +++ b/crates/client/tests/saro_and_raya.rs @@ -1,4 +1,4 @@ -use client::{ +use logos_chat::{ ChatClient, ContentData, ConversationIdOwned, Cursor, InProcessDelivery, StorageConfig, }; use std::sync::Arc; diff --git a/extensions/components/Cargo.toml b/extensions/components/Cargo.toml index 0be31bc..055fad2 100644 --- a/extensions/components/Cargo.toml +++ b/extensions/components/Cargo.toml @@ -4,8 +4,10 @@ version = "0.1.0" edition = "2024" [dependencies] +# Workspace dependencies (sorted) +crypto = { workspace = true } # Needed because Storage traits require "Identity" struct libchat = { workspace = true } storage = { workspace = true } -crypto = { workspace = true } # Needed because Storage traits require "Identity" struct -hex = "0.4.3" \ No newline at end of file +# External dependencies (sorted) +hex = "0.4.3"