Clean warnings

This commit is contained in:
Jazz Turner-Baggs 2026-04-23 18:19:41 -07:00
parent af3ff3c6a2
commit 1d1a3a170e
No known key found for this signature in database
11 changed files with 46 additions and 207 deletions

View File

@ -1,8 +1,8 @@
use std::sync::Arc; use std::sync::Arc;
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
use crate::conversation::{Convo, GroupConvo, GroupV1Convo, IdentityProvider}; use crate::conversation::{Convo, GroupConvo, IdentityProvider};
use crate::ctx::{self, ClientCtx}; use crate::ctx::ClientCtx;
use crate::account::LogosAccount; use crate::account::LogosAccount;
use crate::{DeliveryService, RegistrationService}; use crate::{DeliveryService, RegistrationService};
@ -10,7 +10,7 @@ use crate::{
conversation::{Conversation, ConversationId, Id, PrivateV1Convo}, conversation::{Conversation, ConversationId, Id, PrivateV1Convo},
errors::ChatError, errors::ChatError,
inbox::Inbox, inbox::Inbox,
inbox_v2::{GroupInitializer, InboxV2}, inbox_v2::InboxV2,
proto::{EncryptedPayload, EnvelopeV1, Message}, proto::{EncryptedPayload, EnvelopeV1, Message},
types::{AddressedEnvelope, ContentData}, types::{AddressedEnvelope, ContentData},
}; };
@ -189,12 +189,10 @@ impl<DS: DeliveryService, RS: RegistrationService, CS: ChatStore + 'static> Cont
// Decode bytes and send to protocol for processing. // Decode bytes and send to protocol for processing.
pub fn handle_payload(&mut self, payload: &[u8]) -> Result<Option<ContentData>, ChatError> { pub fn handle_payload(&mut self, payload: &[u8]) -> Result<Option<ContentData>, ChatError> {
let env = EnvelopeV1::decode(payload)?; let env = EnvelopeV1::decode(payload)?;
let e2 = env.clone();
// TODO: Impl Conversation hinting // TODO: Impl Conversation hinting
let convo_id = env.conversation_hint; let convo_id = env.conversation_hint;
let a = self.pq_inbox.id();
match convo_id { match convo_id {
c if c == self.inbox.id() => self.dispatch_to_inbox(&env.payload), c if c == self.inbox.id() => self.dispatch_to_inbox(&env.payload),
c if c == self.pq_inbox.id() => self.dispatch_to_inbox2(&env.payload), c if c == self.pq_inbox.id() => self.dispatch_to_inbox2(&env.payload),
@ -283,6 +281,7 @@ impl<DS: DeliveryService, RS: RegistrationService, CS: ChatStore + 'static> Cont
} }
} }
#[allow(unused)] // Temporary until GroupIntegration is completed
fn load_group_convo( fn load_group_convo(
&mut self, &mut self,
convo_id: ConversationId, convo_id: ConversationId,
@ -309,23 +308,9 @@ impl<DS: DeliveryService, RS: RegistrationService, CS: ChatStore + 'static> Cont
} }
} }
impl<DS: DeliveryService, RS: RegistrationService, CS: ChatStore> GroupInitializer<DS, RS, CS>
for Context<DS, RS, CS>
{
fn on_new_group_convo(
&self,
convo: impl crate::conversation::GroupConvo<DS, RS, CS>,
) -> Result<(), ChatError> {
todo!()
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::{ use std::ops::{Deref, DerefMut};
any::Any,
ops::{Deref, DerefMut},
};
use sqlite::{ChatStorage, StorageConfig}; use sqlite::{ChatStorage, StorageConfig};
use storage::{ConversationStore, IdentityStore}; use storage::{ConversationStore, IdentityStore};
@ -447,14 +432,14 @@ mod tests {
.create_group_convo(&[raya_id.as_ref()]) .create_group_convo(&[raya_id.as_ref()])
.unwrap(); .unwrap();
let CONVO_ID = s_convo.id(); let convo_id = s_convo.id();
// Raya can read this message because // Raya can read this message because
// 1) It was sent after add_members was committed, and // 1) It was sent after add_members was committed, and
// 2) LocalBroadcaster provides historical messages. // 2) LocalBroadcaster provides historical messages.
clients[SARO] clients[SARO]
.convo(CONVO_ID) .convo(convo_id)
.send_content( .send_content(
&mut clients[SARO].client_ctx, &mut clients[SARO].client_ctx,
b"ok who broke the group chat again", b"ok who broke the group chat again",
@ -465,7 +450,7 @@ mod tests {
process(&mut clients); process(&mut clients);
clients[RAYA] clients[RAYA]
.convo(CONVO_ID) .convo(convo_id)
.send_content( .send_content(
&mut clients[RAYA].client_ctx, &mut clients[RAYA].client_ctx,
b"it was literally working five minutes ago", b"it was literally working five minutes ago",
@ -481,7 +466,7 @@ mod tests {
let pax_id = clients[PAX].account_id(); let pax_id = clients[PAX].account_id();
clients[SARO] clients[SARO]
.convo(CONVO_ID) .convo(convo_id)
.add_member(&mut clients[SARO].client_ctx, &[pax_id.as_ref()]) .add_member(&mut clients[SARO].client_ctx, &[pax_id.as_ref()])
.unwrap(); .unwrap();
@ -489,7 +474,7 @@ mod tests {
process(&mut clients); process(&mut clients);
clients[PAX] clients[PAX]
.convo(CONVO_ID) .convo(convo_id)
.send_content( .send_content(
&mut clients[PAX].client_ctx, &mut clients[PAX].client_ctx,
b"ngl the key rotation is cooked", b"ngl the key rotation is cooked",
@ -501,7 +486,7 @@ mod tests {
process(&mut clients); process(&mut clients);
clients[SARO] clients[SARO]
.convo(CONVO_ID) .convo(convo_id)
.send_content( .send_content(
&mut clients[SARO].client_ctx, &mut clients[SARO].client_ctx,
b"bro we literally just added you to the group ", b"bro we literally just added you to the group ",

View File

@ -12,7 +12,7 @@ use std::sync::Arc;
use storage::{ChatStore, ConversationKind, ConversationStore, RatchetStore}; use storage::{ChatStore, ConversationKind, ConversationStore, RatchetStore};
pub use crate::errors::ChatError; pub use crate::errors::ChatError;
pub use group_v1::{GroupV1Convo, IdentityProvider, LogosMlsProvider}; pub use group_v1::{GroupV1Convo, IdentityProvider};
pub use privatev1::PrivateV1Convo; pub use privatev1::PrivateV1Convo;
pub type ConversationId<'a> = &'a str; pub type ConversationId<'a> = &'a str;

View File

@ -3,17 +3,14 @@ use std::rc::Rc;
use blake2::{Blake2b, Digest, digest::consts::U6}; use blake2::{Blake2b, Digest, digest::consts::U6};
use crypto::Ed25519VerifyingKey; use crypto::Ed25519VerifyingKey;
use openmls::prelude::tls_codec::Deserialize;
use openmls::prelude::*; use openmls::prelude::*;
use openmls::{prelude::tls_codec::Deserialize, treesync::RatchetTree};
use openmls_libcrux_crypto::Provider as LibcruxProvider; use openmls_libcrux_crypto::Provider as LibcruxProvider;
use openmls::prelude::MlsMessageBodyIn;
use openmls_traits::signatures::Signer as OpenMlsSigner; use openmls_traits::signatures::Signer as OpenMlsSigner;
use openmls_traits::storage::StorageProvider;
use prost::Message;
use crate::{ use crate::{
AddressedEnvelope, DeliveryService, RegistrationService, DeliveryService, RegistrationService,
conversation::{ChatError, ConversationId, Convo, GroupConvo, Id}, conversation::{ChatError, ConversationId, Convo, GroupConvo, Id},
ctx::ClientCtx, ctx::ClientCtx,
types::{AddressedEncryptedPayload, ContentData}, types::{AddressedEncryptedPayload, ContentData},
@ -49,13 +46,6 @@ pub trait MlsCtx {
fn get_credential(&self) -> CredentialWithKey; fn get_credential(&self) -> CredentialWithKey;
} }
pub trait LogosMlsProvider: OpenMlsProvider {}
pub trait GroupMlsStorageV1 {
fn save_state(&self, state: &[u8]);
fn load_state(&self) -> Vec<u8>;
}
pub struct GroupV1Convo<Ctx: MlsCtx> { pub struct GroupV1Convo<Ctx: MlsCtx> {
ctx: Rc<RefCell<Ctx>>, ctx: Rc<RefCell<Ctx>>,
pub(crate) mls_group: MlsGroup, // TODO: (!) Fix Visibility pub(crate) mls_group: MlsGroup, // TODO: (!) Fix Visibility
@ -150,12 +140,7 @@ impl<Ctx: MlsCtx> GroupV1Convo<Ctx> {
return Err(ChatError::NoConvo("mls group not found".into())); return Err(ChatError::NoConvo("mls group not found".into()));
}; };
// println!( Self::subscribe(ds, &convo_id)?;
// "\n>>> {}. {:?}",
// ctx.borrow().ident().friendly_name(),
// mls_group
// );
Self::subscribe(ds, &convo_id);
Ok(GroupV1Convo { Ok(GroupV1Convo {
ctx, ctx,
@ -173,10 +158,6 @@ impl<Ctx: MlsCtx> GroupV1Convo<Ctx> {
Ok(()) Ok(())
} }
pub fn ratchet_tree(&self) -> RatchetTree {
self.mls_group.export_ratchet_tree()
}
fn mls_create_config() -> MlsGroupCreateConfig { fn mls_create_config() -> MlsGroupCreateConfig {
MlsGroupCreateConfig::builder() MlsGroupCreateConfig::builder()
.ciphersuite(Ciphersuite::MLS_256_XWING_CHACHA20POLY1305_SHA256_Ed25519) .ciphersuite(Ciphersuite::MLS_256_XWING_CHACHA20POLY1305_SHA256_Ed25519)
@ -234,8 +215,6 @@ impl<Ctx: MlsCtx> GroupV1Convo<Ctx> {
)?; //TODO: P3 - Hardcoded Protocol Version )?; //TODO: P3 - Hardcoded Protocol Version
Ok(keypkg) Ok(keypkg)
} }
fn save_state<CS: ChatStore>(&self, store: &CS) {}
} }
impl<Ctx: MlsCtx> Id for GroupV1Convo<Ctx> { impl<Ctx: MlsCtx> Id for GroupV1Convo<Ctx> {
@ -400,34 +379,3 @@ impl<Ctx: MlsCtx, DS: DeliveryService, RS: RegistrationService, CS: ChatStore>
.map_err(|e| ChatError::Generic(format!("Publish: {e}"))) .map_err(|e| ChatError::Generic(format!("Publish: {e}")))
} }
} }
use prost::Oneof;
#[derive(Clone, PartialEq, Message)]
pub struct GroupV1Frame {
#[prost(string, tag = "1")]
pub sender: String,
#[prost(uint64, tag = "2")]
pub timestamp: u64,
// oneof field — optional, holds one variant
#[prost(oneof = "FrameType", tags = "3, 4, 5")]
pub payload: Option<FrameType>,
}
#[derive(Clone, PartialEq, Oneof)]
pub enum FrameType {
#[prost(bytes, tag = "3")]
Welcome(Vec<u8>),
}
#[cfg(test)]
mod tests {
use crypto::PrivateKey;
use super::*;
#[test]
fn test_mls() {}
}

View File

@ -1,5 +1,5 @@
use std::{ use std::{
cell::{Ref, RefCell, RefMut}, cell::{RefCell, RefMut},
rc::Rc, rc::Rc,
}; };
@ -30,7 +30,7 @@ impl<'a, DS: DeliveryService, RS: RegistrationService, CS: ChatStore> ClientCtx<
&mut self.contact_registry &mut self.contact_registry
} }
pub fn store(&'a self) -> RefMut<CS> { pub fn store(&'a self) -> RefMut<'a, CS> {
self.convo_store.borrow_mut() self.convo_store.borrow_mut()
} }
} }

View File

@ -1,27 +1,7 @@
use std::{cell::RefCell, fmt::Debug, fmt::Display, rc::Rc}; use std::{fmt::Debug, fmt::Display};
use crate::types::AddressedEnvelope; use crate::types::AddressedEnvelope;
pub struct Service<T> {
inner: Rc<RefCell<T>>,
}
impl<T> Service<T> {
pub fn new(t: T) -> Self {
Self {
inner: Rc::new(RefCell::new(t)),
}
}
fn with<F, R>(&self, f: F) -> R
where
F: FnOnce(&T) -> R,
{
let inner = self.inner.borrow();
f(&inner)
}
}
pub trait DeliveryService { pub trait DeliveryService {
type Error: Display; type Error: Display;
fn publish(&mut self, envelope: AddressedEnvelope) -> Result<(), Self::Error>; fn publish(&mut self, envelope: AddressedEnvelope) -> Result<(), Self::Error>;

View File

@ -1,22 +1,17 @@
use std::any::Any;
use std::cell::{Ref, RefCell}; use std::cell::{Ref, RefCell};
use std::collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
use chat_proto::logoschat::envelope::EnvelopeV1; use chat_proto::logoschat::envelope::EnvelopeV1;
use crypto::Ed25519SigningKey; use crypto::Ed25519SigningKey;
use crypto::Ed25519VerifyingKey; use crypto::Ed25519VerifyingKey;
use crypto::PublicKey;
use openmls::prelude::tls_codec::Serialize; use openmls::prelude::tls_codec::Serialize;
use openmls::{prelude::*, treesync::RatchetTree}; use openmls::prelude::*;
use openmls_libcrux_crypto::Provider as LibcruxProvider; use openmls_libcrux_crypto::Provider as LibcruxProvider;
use openmls_traits::signatures::Signer; use openmls_traits::signatures::Signer;
use openmls_traits::storage::StorageProvider;
use prost::{Message, Oneof}; use prost::{Message, Oneof};
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
use storage::ChatStore; use storage::ChatStore;
use storage::ConversationMeta; use storage::ConversationMeta;
use storage::ConversationStore;
use crate::AddressedEnvelope; use crate::AddressedEnvelope;
use crate::ChatError; use crate::ChatError;
@ -26,9 +21,7 @@ use crate::conversation::GroupConvo;
use crate::conversation::group_v1::{MlsCtx, MlsInitializer}; use crate::conversation::group_v1::{MlsCtx, MlsInitializer};
use crate::conversation::{GroupV1Convo, IdentityProvider}; use crate::conversation::{GroupV1Convo, IdentityProvider};
use crate::ctx::ClientCtx; use crate::ctx::ClientCtx;
use crate::types::AddressedEncryptedPayload; use crate::utils::{blake2b_hex, hash_size};
use crate::utils::hash_size::Testing;
use crate::utils::{blake2b_hex, hash_size, hex_trunc};
static ACCOUNT_COUNTER: AtomicUsize = AtomicUsize::new(0); static ACCOUNT_COUNTER: AtomicUsize = AtomicUsize::new(0);
@ -119,15 +112,10 @@ impl<Init: MlsInitializer + Clone> MlsCtx for MlsContext<Init> {
} }
} }
pub trait GroupInitializer<DS: DeliveryService, RS: RegistrationService, CS: ChatStore> {
fn on_new_group_convo(&self, convo: impl GroupConvo<DS, RS, CS>) -> Result<(), ChatError>;
}
#[derive(Clone)] #[derive(Clone)]
pub struct InboxV2 { pub struct InboxV2 {
pub account: LogosAccount, // TODO: (!) don't expose account pub account: LogosAccount, // TODO: (!) don't expose account
mls_provider: Rc<RefCell<LibcruxProvider>>, mls_provider: Rc<RefCell<LibcruxProvider>>,
convo_map: HashMap<String, Vec<u8>>,
} }
impl<'a> InboxV2 { impl<'a> InboxV2 {
@ -137,7 +125,6 @@ impl<'a> InboxV2 {
Self { Self {
account, account,
mls_provider, mls_provider,
convo_map: HashMap::new(),
} }
} }
@ -219,7 +206,7 @@ impl<'a> InboxV2 {
ctx: &mut ClientCtx<DS, RS, CS>, ctx: &mut ClientCtx<DS, RS, CS>,
invite: GroupV1HeavyInvite, invite: GroupV1HeavyInvite,
) -> Result<(), ChatError> { ) -> Result<(), ChatError> {
let (msg_in, rest) = MlsMessageIn::tls_deserialize_bytes(invite.welcome_bytes.as_slice())?; let (msg_in, _rest) = MlsMessageIn::tls_deserialize_bytes(invite.welcome_bytes.as_slice())?;
let MlsMessageBodyIn::Welcome(welcome) = msg_in.extract() else { let MlsMessageBodyIn::Welcome(welcome) = msg_in.extract() else {
return Err(ChatError::ProtocolExpectation( return Err(ChatError::ProtocolExpectation(
@ -264,21 +251,6 @@ impl<'a> InboxV2 {
blake2b_hex::<hash_size::Testing>(&["InboxV2|", "conversation_id|", account_id]) blake2b_hex::<hash_size::Testing>(&["InboxV2|", "conversation_id|", account_id])
} }
fn dbg_mls_store(ctx: &MlsContext<InboxV2>, prefix: impl AsRef<str>) {
let pa = ctx.provider.borrow();
let data = &*pa.storage().values.read().unwrap();
println!(":::MlsProviderStore::: -- {}", prefix.as_ref());
for key in data.keys() {
let val = match data.get(key) {
Some(x) => format!("{} ({})", hex_trunc(x), blake2b_hex::<Testing>(&[x])),
None => "None".into(),
};
println!(". {:?}: {:?}", hex_trunc(key), val)
}
}
pub fn load_mls_convo<DS: DeliveryService, RS: RegistrationService, CS: ChatStore>( pub fn load_mls_convo<DS: DeliveryService, RS: RegistrationService, CS: ChatStore>(
&self, &self,
ctx: &mut ClientCtx<DS, RS, CS>, ctx: &mut ClientCtx<DS, RS, CS>,
@ -343,41 +315,3 @@ pub struct GroupV1HeavyInvite {
#[prost(bytes, tag = "1")] #[prost(bytes, tag = "1")]
pub welcome_bytes: Vec<u8>, pub welcome_bytes: Vec<u8>,
} }
#[cfg(test)]
mod tests {
use super::*;
use openmls_traits::signatures::Signer;
struct Account {
name: String,
signing_key: crypto::Ed25519SigningKey,
}
impl Signer for Account {
fn sign(&self, payload: &[u8]) -> Result<Vec<u8>, openmls_traits::signatures::SignerError> {
Ok(self.signing_key.sign(payload).as_ref().to_vec())
}
fn signature_scheme(&self) -> SignatureScheme {
SignatureScheme::ED25519
}
}
impl IdentityProvider for Account {
fn friendly_name(&self) -> String {
self.name.clone()
}
fn public_key(&self) -> Ed25519VerifyingKey {
todo!()
}
}
#[test]
fn dev() {
// let inbox = InboxV2::new(...);
// let group = inbox.create_group_v1().unwrap();
// let bytes = group.send("hello".as_bytes());
}
}

View File

@ -2,23 +2,18 @@ use std::{
cell::RefCell, cell::RefCell,
collections::{HashMap, HashSet, VecDeque}, collections::{HashMap, HashSet, VecDeque},
fmt::Debug, fmt::Debug,
io::Cursor,
rc::Rc, rc::Rc,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
use storage::{ChatStore, ConversationMeta, ConversationStore, IdentityStore}; use storage::{ConversationMeta, ConversationStore, IdentityStore};
use storage::{EphemeralKeyStore, RatchetStore}; use storage::{EphemeralKeyStore, RatchetStore};
use crate::{ use crate::{
AddressedEnvelope, DeliveryService, RegistrationService, AddressedEnvelope, DeliveryService, RegistrationService,
utils::{blake2b_hex, hash_size::Testing, hex_trunc}, utils::{blake2b_hex, hash_size::Testing},
}; };
type Callback = Rc<dyn Fn(String, &Vec<u8>)>;
type Filter = Box<dyn Fn(&Vec<u8>) -> bool>;
#[derive(Debug)] #[derive(Debug)]
struct BroadcasterShared<T> { struct BroadcasterShared<T> {
/// Per-address message queue; all published messages are appended here. /// Per-address message queue; all published messages are appended here.
@ -64,7 +59,7 @@ impl LocalBroadcaster {
/// own independent cursor — it starts from the beginning of each address /// own independent cursor — it starts from the beginning of each address
/// queue regardless of what any other consumer has already processed. /// queue regardless of what any other consumer has already processed.
pub fn new_consumer(&self) -> Self { pub fn new_consumer(&self) -> Self {
let mut inner = self.shared.clone(); let inner = self.shared.clone();
let cursor = inner.borrow().tail(); let cursor = inner.borrow().tail();
Self { Self {
shared: inner, shared: inner,
@ -94,10 +89,6 @@ impl LocalBroadcaster {
} }
} }
pub fn clear(&mut self) {
self.cursor = self.shared.borrow().tail();
}
fn msg_id(msg: &AddressedEnvelope) -> String { fn msg_id(msg: &AddressedEnvelope) -> String {
blake2b_hex::<Testing>(&[msg.data.as_slice()]) blake2b_hex::<Testing>(&[msg.data.as_slice()])
} }
@ -183,14 +174,12 @@ impl RegistrationService for EphemeralRegistry {
pub struct MemStore { pub struct MemStore {
convos: HashMap<String, ConversationMeta>, convos: HashMap<String, ConversationMeta>,
state: HashMap<String, Vec<u8>>,
} }
impl MemStore { impl MemStore {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
convos: HashMap::new(), convos: HashMap::new(),
state: HashMap::new(),
} }
} }
} }
@ -213,7 +202,7 @@ impl ConversationStore for MemStore {
Ok(a) Ok(a)
} }
fn remove_conversation(&mut self, local_convo_id: &str) -> Result<(), storage::StorageError> { fn remove_conversation(&mut self, _local_convo_id: &str) -> Result<(), storage::StorageError> {
todo!() todo!()
} }
@ -232,7 +221,7 @@ impl IdentityStore for MemStore {
Ok(None) Ok(None)
} }
fn save_identity(&mut self, identity: &crypto::Identity) -> Result<(), storage::StorageError> { fn save_identity(&mut self, _identity: &crypto::Identity) -> Result<(), storage::StorageError> {
// todo!() // todo!()
Ok(()) Ok(())
} }
@ -241,20 +230,20 @@ impl IdentityStore for MemStore {
impl EphemeralKeyStore for MemStore { impl EphemeralKeyStore for MemStore {
fn save_ephemeral_key( fn save_ephemeral_key(
&mut self, &mut self,
public_key_hex: &str, _public_key_hex: &str,
private_key: &crypto::PrivateKey, _private_key: &crypto::PrivateKey,
) -> Result<(), storage::StorageError> { ) -> Result<(), storage::StorageError> {
todo!() todo!()
} }
fn load_ephemeral_key( fn load_ephemeral_key(
&self, &self,
public_key_hex: &str, _public_key_hex: &str,
) -> Result<Option<crypto::PrivateKey>, storage::StorageError> { ) -> Result<Option<crypto::PrivateKey>, storage::StorageError> {
todo!() todo!()
} }
fn remove_ephemeral_key(&mut self, public_key_hex: &str) -> Result<(), storage::StorageError> { fn remove_ephemeral_key(&mut self, _public_key_hex: &str) -> Result<(), storage::StorageError> {
todo!() todo!()
} }
} }
@ -262,38 +251,41 @@ impl EphemeralKeyStore for MemStore {
impl RatchetStore for MemStore { impl RatchetStore for MemStore {
fn save_ratchet_state( fn save_ratchet_state(
&mut self, &mut self,
conversation_id: &str, _conversation_id: &str,
state: &storage::RatchetStateRecord, _state: &storage::RatchetStateRecord,
skipped_keys: &[storage::SkippedKeyRecord], _skipped_keys: &[storage::SkippedKeyRecord],
) -> Result<(), storage::StorageError> { ) -> Result<(), storage::StorageError> {
todo!() todo!()
} }
fn load_ratchet_state( fn load_ratchet_state(
&self, &self,
conversation_id: &str, _conversation_id: &str,
) -> Result<storage::RatchetStateRecord, storage::StorageError> { ) -> Result<storage::RatchetStateRecord, storage::StorageError> {
todo!() todo!()
} }
fn load_skipped_keys( fn load_skipped_keys(
&self, &self,
conversation_id: &str, _conversation_id: &str,
) -> Result<Vec<storage::SkippedKeyRecord>, storage::StorageError> { ) -> Result<Vec<storage::SkippedKeyRecord>, storage::StorageError> {
todo!() todo!()
} }
fn has_ratchet_state(&self, conversation_id: &str) -> Result<bool, storage::StorageError> { fn has_ratchet_state(&self, _conversation_id: &str) -> Result<bool, storage::StorageError> {
todo!() todo!()
} }
fn delete_ratchet_state(&mut self, conversation_id: &str) -> Result<(), storage::StorageError> { fn delete_ratchet_state(
&mut self,
_conversation_id: &str,
) -> Result<(), storage::StorageError> {
todo!() todo!()
} }
fn cleanup_old_skipped_keys( fn cleanup_old_skipped_keys(
&mut self, &mut self,
max_age_secs: i64, _max_age_secs: i64,
) -> Result<usize, storage::StorageError> { ) -> Result<usize, storage::StorageError> {
todo!() todo!()
} }

View File

@ -60,7 +60,7 @@ pub struct ContentData {
// Internal type Definitions // Internal type Definitions
// Used by Conversations to attach addresses to outbound encrypted payloads // Used by Conversations to attach addresses to outbound encrypted payloads
pub(crate) struct AddressedEncryptedPayload { pub struct AddressedEncryptedPayload {
pub delivery_address: String, pub delivery_address: String,
pub data: proto::EncryptedPayload, pub data: proto::EncryptedPayload,
} }

View File

@ -58,6 +58,8 @@ pub fn blake2b_hex<LEN: hash_size::HashLen>(components: &[impl AsRef<[u8]>]) ->
hex::encode(output) hex::encode(output)
} }
/// Shorten byte slices for testing and logging
#[allow(unused)]
pub fn hex_trunc(data: &[u8]) -> String { pub fn hex_trunc(data: &[u8]) -> String {
if data.len() <= 8 { if data.len() <= 8 {
hex::encode(data) hex::encode(data)

View File

@ -4,8 +4,6 @@ mod signatures;
mod x3dh; mod x3dh;
mod xeddsa_sign; mod xeddsa_sign;
use thiserror::Error;
pub use identity::Identity; pub use identity::Identity;
pub use keys::{PrivateKey, PublicKey, SymmetricKey32}; pub use keys::{PrivateKey, PublicKey, SymmetricKey32};
pub use signatures::{Ed25519SigningKey, Ed25519VerifyingKey}; pub use signatures::{Ed25519SigningKey, Ed25519VerifyingKey};

View File

@ -10,8 +10,8 @@ use std::collections::HashSet;
use crypto::{Identity, PrivateKey}; use crypto::{Identity, PrivateKey};
use rusqlite::{Transaction, params}; use rusqlite::{Transaction, params};
use storage::{ use storage::{
ChatStore, ConversationKind, ConversationMeta, ConversationStore, EphemeralKeyStore, ConversationKind, ConversationMeta, ConversationStore, EphemeralKeyStore, IdentityStore,
IdentityStore, RatchetStateRecord, RatchetStore, SkippedKeyRecord, StorageError, RatchetStateRecord, RatchetStore, SkippedKeyRecord, StorageError,
}; };
use zeroize::Zeroize; use zeroize::Zeroize;