mirror of
https://github.com/logos-messaging/logos-chat-rs.git
synced 2026-07-29 11:23:11 +00:00
Add base functions
This commit is contained in:
parent
fc23911bd3
commit
325f30aab9
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -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"}
|
||||
|
||||
@ -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<String>) -> Self {
|
||||
Client {
|
||||
ctx: Context::new_with_name(name),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_intro_bundle(&mut self) -> Result<Vec<u8>, ChatError> {
|
||||
self.ctx.create_intro_bundle()
|
||||
}
|
||||
|
||||
pub fn create_private_convo(
|
||||
&mut self,
|
||||
remote_bundle: &Introduction,
|
||||
content: &[u8],
|
||||
) -> (ConversationIdOwned, Vec<AddressedEnvelope>) {
|
||||
self.ctx.create_private_convo(remote_bundle, content)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user