mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-12 10:03:13 +00:00
Implements issue #112: MLS group state must survive process restarts. The MLS provider hardcoded an in-memory store separate from the chat store, so a restart lost every group. Fold the OpenMLS StorageProvider into libchat's own ChatStore so one durable store holds both chat state and MLS group state. - storage: ChatStore subsumes StorageProvider<CURRENT_VERSION>, so a ChatStore is the whole durable-storage contract (identity/ephemeral/conversation/ratchet sub-stores plus the MLS key-value surface). - chat-sqlite: ChatStorage implements StorageProvider over an mls_kv table (migration 003_mls_storage), a byte-faithful port of MemoryStorage with decode errors surfaced instead of unwrapped and the reference clear_proposal_queue orphan-key bug fixed. The separate SqliteMlsStorage type is removed. - conversations: MlsPqProvider becomes a transient view borrowing the shared store and a long-lived crypto backend, so the store stays singly owned; ServiceContext hands it out via mls_provider(). ExternalServices drops its ST associated type, leaving one CS. GroupV2/de_mls's thread-safe-error bound is restated on CS because an associated-type bound does not elaborate through a supertrait. - client: the store is always ChatStorage, so fix it as such and drop the vestigial store generic from ChatClient and the builder. Retire the stubbed in-memory MemStore in favour of ChatStorage::in_memory(). - GroupV1 conversations resume across a restart through the existing MlsGroup::load path, proven by a drop-and-reload integration test.
47 lines
1.7 KiB
Rust
47 lines
1.7 KiB
Rust
mod account_directory;
|
|
mod causal_history;
|
|
mod conversation;
|
|
mod core;
|
|
mod crypto;
|
|
mod errors;
|
|
mod inbox;
|
|
mod inbox_v2;
|
|
mod outcomes;
|
|
mod proto;
|
|
mod service_context;
|
|
mod service_traits;
|
|
mod types;
|
|
mod utils;
|
|
|
|
pub use account_directory::{
|
|
AccountAuthority, AccountDirectory, BUNDLE_VERSION, BundleError, DecodedBundle, DeviceId,
|
|
DeviceSet, Lamport, SignedDeviceBundle, decode_bundle_payload, encode_bundle_payload,
|
|
resolve_device_ids, verify_bundle,
|
|
};
|
|
pub use causal_history::{Frontier, MissingMessage};
|
|
pub use chat_sqlite::ChatStorage;
|
|
pub use chat_sqlite::MlsStorageError;
|
|
pub use chat_sqlite::StorageConfig;
|
|
pub use core::{ConversationId, Core, Introduction};
|
|
pub use errors::ChatError;
|
|
pub use outcomes::{
|
|
Content, ConversationClass, ConvoOutcome, InboxOutcome, NewConversation, PayloadOutcome,
|
|
};
|
|
pub use service_context::ExternalServices;
|
|
pub use service_traits::{DeliveryService, RegistrationService, WakeupService};
|
|
pub use shared_traits::{IdentId, IdentIdRef, IdentityProvider};
|
|
pub use storage::{ChatStore, ConversationKind};
|
|
pub use types::AddressedEnvelope;
|
|
pub use utils::{hex_trunc, trunc};
|
|
|
|
/// OpenMLS storage requirements, re-exported so external providers can implement
|
|
/// a durable [`StorageProvider`](openmls_traits::storage::StorageProvider)
|
|
/// without depending on `openmls_traits` directly. [`ChatStorage`] is libchat's
|
|
/// own durable implementation, and [`ChatStore`] folds this surface in so one
|
|
/// store type serves both chat and MLS state.
|
|
pub mod mls_storage {
|
|
pub use openmls_memory_storage::MemoryStorage;
|
|
pub use openmls_traits::OpenMlsProvider;
|
|
pub use openmls_traits::storage::{CURRENT_VERSION, Entity, Key, StorageProvider, traits};
|
|
}
|