2025-12-22 09:40:46 -08:00
|
|
|
mod api;
|
|
|
|
|
mod context;
|
|
|
|
|
mod conversation;
|
2026-01-22 06:39:09 +07:00
|
|
|
mod crypto;
|
2025-12-22 09:40:46 -08:00
|
|
|
mod errors;
|
2026-01-22 06:39:09 +07:00
|
|
|
mod identity;
|
2025-12-22 09:40:46 -08:00
|
|
|
mod inbox;
|
2026-01-22 06:39:09 +07:00
|
|
|
mod proto;
|
|
|
|
|
mod types;
|
|
|
|
|
mod utils;
|
2025-12-22 09:40:46 -08:00
|
|
|
|
|
|
|
|
pub use api::*;
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
|
|
|
|
|
use super::*;
|
2026-01-29 00:59:07 +07:00
|
|
|
use std::str::FromStr;
|
2025-12-22 09:40:46 -08:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_ffi() {}
|
|
|
|
|
|
|
|
|
|
#[test]
|
2026-01-29 00:59:07 +07:00
|
|
|
fn test_invite_convo() {
|
|
|
|
|
let mut ctx = create_context();
|
|
|
|
|
let mut bundle = vec![0u8; 200];
|
2025-12-22 09:40:46 -08:00
|
|
|
|
2026-01-29 00:59:07 +07:00
|
|
|
let bundle_len = create_intro_bundle(&mut ctx, (&mut bundle[..]).into());
|
2025-12-22 09:40:46 -08:00
|
|
|
unsafe {
|
2026-01-29 00:59:07 +07:00
|
|
|
bundle.set_len(bundle_len as usize);
|
2025-12-22 09:40:46 -08:00
|
|
|
}
|
|
|
|
|
|
2026-01-29 00:59:07 +07:00
|
|
|
assert!(bundle_len > 0, "bundle failed: {}", bundle_len);
|
|
|
|
|
let content = String::from_str("Hello").unwrap();
|
|
|
|
|
let result = create_new_private_convo(
|
|
|
|
|
&mut ctx,
|
|
|
|
|
bundle.as_slice().into(),
|
|
|
|
|
content.as_bytes().into(),
|
|
|
|
|
);
|
2025-12-22 09:40:46 -08:00
|
|
|
|
2026-01-29 00:59:07 +07:00
|
|
|
assert!(result.error_code == 0, "Error: {}", result.error_code);
|
2025-12-22 09:40:46 -08:00
|
|
|
|
2026-01-29 00:59:07 +07:00
|
|
|
println!(" ID:{:?} Payloads:{:?}", result.convo_id, result.payloads);
|
2025-12-22 09:40:46 -08:00
|
|
|
|
2026-01-29 00:59:07 +07:00
|
|
|
destroy_context(ctx);
|
2025-12-22 09:40:46 -08:00
|
|
|
}
|
|
|
|
|
}
|