From 325f30aab9663f8704931306e38f09c7fd9f586d Mon Sep 17 00:00:00 2001 From: Jazz Turner-Baggs <473256+jazzz@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:39:38 +0000 Subject: [PATCH] Add base functions --- Cargo.lock | 8 ++++---- chat/Cargo.toml | 2 +- chat/src/client.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1153dec..594341d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,7 +231,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto" version = "0.1.0" -source = "git+https://github.com/logos-messaging/libchat.git#d006f20bcede00447fa4a09a42c0a18718057498" +source = "git+https://github.com/logos-messaging/libchat.git?branch=expose_rust_api#a8717df66e8791c34ad859ee33fdc4e3992c8b63" dependencies = [ "ed25519-dalek", "generic-array 1.3.5", @@ -340,7 +340,7 @@ dependencies = [ [[package]] name = "double-ratchets" version = "0.0.1" -source = "git+https://github.com/logos-messaging/libchat.git#d006f20bcede00447fa4a09a42c0a18718057498" +source = "git+https://github.com/logos-messaging/libchat.git?branch=expose_rust_api#a8717df66e8791c34ad859ee33fdc4e3992c8b63" dependencies = [ "blake2", "chacha20poly1305", @@ -719,7 +719,7 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libchat" version = "0.1.0" -source = "git+https://github.com/logos-messaging/libchat.git#d006f20bcede00447fa4a09a42c0a18718057498" +source = "git+https://github.com/logos-messaging/libchat.git?branch=expose_rust_api#a8717df66e8791c34ad859ee33fdc4e3992c8b63" dependencies = [ "base64", "blake2", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "storage" version = "0.1.0" -source = "git+https://github.com/logos-messaging/libchat.git#d006f20bcede00447fa4a09a42c0a18718057498" +source = "git+https://github.com/logos-messaging/libchat.git?branch=expose_rust_api#a8717df66e8791c34ad859ee33fdc4e3992c8b63" dependencies = [ "rusqlite", "thiserror", diff --git a/chat/Cargo.toml b/chat/Cargo.toml index 7ae34d0..74b22b4 100644 --- a/chat/Cargo.toml +++ b/chat/Cargo.toml @@ -20,4 +20,4 @@ mpsc = "0.2.6" serde_json = "1" tokio = { version = "1.48.0", features = ["full", "tokio-macros"] } tracing = "0.1" -libchat = {git = "https://github.com/logos-messaging/libchat.git"} +libchat = {git = "https://github.com/logos-messaging/libchat.git", branch = "expose_rust_api"} diff --git a/chat/src/client.rs b/chat/src/client.rs index e69de29..3a6a10d 100644 --- a/chat/src/client.rs +++ b/chat/src/client.rs @@ -0,0 +1,26 @@ +use libchat::context::{Context, ConversationIdOwned, Introduction}; +use libchat::errors::ChatError; +use libchat::types::AddressedEnvelope; +struct Client { + ctx: Context, +} + +impl Client { + pub fn new_with_name(name: impl Into) -> Self { + Client { + ctx: Context::new_with_name(name), + } + } + + pub fn create_intro_bundle(&mut self) -> Result, ChatError> { + self.ctx.create_intro_bundle() + } + + pub fn create_private_convo( + &mut self, + remote_bundle: &Introduction, + content: &[u8], + ) -> (ConversationIdOwned, Vec) { + self.ctx.create_private_convo(remote_bundle, content) + } +}