chore: remove crypto for identity

This commit is contained in:
kaichaosun 2026-02-03 14:42:10 +08:00
parent 572ae6d954
commit 2e48e49a9a
No known key found for this signature in database
GPG Key ID: 223E0F992F4F03BF
12 changed files with 23 additions and 29 deletions

View File

@ -1,8 +1,7 @@
use std::{collections::HashMap, rc::Rc, sync::Arc};
use crate::{
// conversation::{ConversationStore, Convo, Id},
conversation::common::{HasConversationId, OutboundSession, SessionRegistry},
dm::common::{HasConversationId, OutboundSession, SessionRegistry},
errors::ChatError,
identity::Identity,
inbox::Inbox,
@ -122,7 +121,7 @@ impl Context {
#[cfg(test)]
mod tests {
use crate::conversation::privatev1::PrivateV1Convo;
use crate::dm::privatev1::PrivateV1Convo;
use super::*;

View File

@ -1,12 +0,0 @@
use prost::bytes::Bytes;
pub use x25519_dalek::{PublicKey, StaticSecret};
pub trait CopyBytes {
fn copy_to_bytes(&self) -> Bytes;
}
impl CopyBytes for PublicKey {
fn copy_to_bytes(&self) -> Bytes {
Bytes::copy_from_slice(self.as_bytes())
}
}

View File

@ -6,7 +6,7 @@ use crypto::SecretKey;
use prost::{Message, bytes::Bytes};
use crate::{
conversation::common::{HasConversationId, OutboundSession, SessionId},
dm::common::{HasConversationId, OutboundSession, SessionId},
errors::ChatError,
types::AddressedEncryptedPayload,
utils::timestamp_millis,

View File

@ -0,0 +1 @@
// Group chat module

View File

@ -1,7 +1,6 @@
use blake2::{Blake2b512, Digest};
use std::fmt;
use crate::crypto::{PublicKey, StaticSecret};
pub use x25519_dalek::{PublicKey, StaticSecret};
pub struct Identity {
secret: StaticSecret,

View File

@ -5,7 +5,7 @@ use blake2::{
use crypto::{DomainSeparator, PrekeyBundle, SecretKey, X3Handshake};
use rand_core::{CryptoRng, RngCore};
use crate::crypto::{PublicKey, StaticSecret};
use crate::identity::{PublicKey, StaticSecret};
type Blake2bMac256 = Blake2bMac<U32>;

View File

@ -8,15 +8,13 @@ use std::rc::Rc;
use crypto::{PrekeyBundle, SecretKey};
use crate::context::Introduction;
use crate::conversation::common::{
HasConversationId, InboundSessionHandler, OutboundSession, SessionId,
};
use crate::conversation::privatev1::PrivateV1Convo;
use crate::crypto::{CopyBytes, PublicKey, StaticSecret};
use crate::dm::common::{HasConversationId, InboundSessionHandler, OutboundSession, SessionId};
use crate::dm::privatev1::PrivateV1Convo;
use crate::errors::ChatError;
use crate::identity::Identity;
use crate::identity::{PublicKey, StaticSecret};
use crate::inbox::handshake::InboxHandshake;
use crate::proto;
use crate::proto::{self, CopyBytes};
use crate::types::{AddressedEncryptedPayload, ContentData};
/// Compute the deterministic Delivery_address for an installation

View File

@ -1,8 +1,8 @@
mod api;
mod context;
pub mod conversation;
mod crypto;
pub mod dm;
mod errors;
mod group;
mod identity;
pub mod inbox;
mod proto;
@ -10,8 +10,6 @@ mod types;
mod utils;
pub use api::*;
pub use conversation::common::{HasConversationId, InboundSessionHandler, OutboundSession};
pub use inbox::Inbox;
#[cfg(test)]
mod tests {

View File

@ -7,3 +7,14 @@ pub use chat_proto::logoschat::invite::InvitePrivateV1;
pub use prost::Message;
pub use prost::bytes::Bytes;
use x25519_dalek::PublicKey;
pub trait CopyBytes {
fn copy_to_bytes(&self) -> Bytes;
}
impl CopyBytes for PublicKey {
fn copy_to_bytes(&self) -> Bytes {
Bytes::copy_from_slice(self.as_bytes())
}
}