Skip to content
Merged
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
38 changes: 0 additions & 38 deletions core/conversations/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ use safer_ffi::{
prelude::{c_slice, repr_c},
};

use storage::StorageConfig;

use crate::{
context::{Context, Introduction},
errors::ChatError,
ffi::utils::CResult,
types::ContentData,
};

Expand Down Expand Up @@ -57,41 +54,6 @@ pub fn create_context(name: repr_c::String) -> repr_c::Box<ContextHandle> {
Box::new(ContextHandle(Context::new_with_name(&*name))).into()
}

/// Creates a new libchat Context with file-based persistent storage.
///
/// The identity will be loaded from storage if it exists, or created and saved if not.
///
/// # Parameters
/// - name: Friendly name for the identity (used if creating new identity)
/// - db_path: Path to the SQLite database file
/// - db_secret: Secret key for encrypting the database
///
/// # Returns
/// CResult with context handle on success, or error string on failure.
/// On success, the context handle must be freed with `destroy_context()` after usage.
/// On error, the error string must be freed with `destroy_string()` after usage.
#[ffi_export]
pub fn create_context_with_storage(
name: repr_c::String,
db_path: repr_c::String,
db_secret: repr_c::String,
) -> CResult<repr_c::Box<ContextHandle>, repr_c::String> {
let config = StorageConfig::Encrypted {
path: db_path.to_string(),
key: db_secret.to_string(),
};
match Context::open(&*name, config) {
Ok(ctx) => CResult {
ok: Some(Box::new(ContextHandle(ctx)).into()),
err: None,
},
Err(e) => CResult {
ok: None,
err: Some(e.to_string().into()),
},
}
}

/// Returns the friendly name of the contexts installation.
///
#[ffi_export]
Expand Down
1 change: 0 additions & 1 deletion core/conversations/src/ffi/mod.rs

This file was deleted.

8 changes: 0 additions & 8 deletions core/conversations/src/ffi/utils.rs

This file was deleted.

1 change: 0 additions & 1 deletion core/conversations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ mod context;
mod conversation;
mod crypto;
mod errors;
mod ffi;
mod identity;
mod inbox;
mod proto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Chat-specific storage implementation.

mod migrations;
mod types;

use storage::{RusqliteError, SqliteDb, StorageConfig, StorageError, params};
use zeroize::Zeroize;

use super::migrations;
use super::types::IdentityRecord;
use crate::identity::Identity;
use crate::{identity::Identity, storage::types::IdentityRecord};

/// Chat-specific storage operations.
///
Expand Down
7 changes: 0 additions & 7 deletions core/conversations/src/storage/mod.rs

This file was deleted.

Loading