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 std::{collections::HashMap, rc::Rc, sync::Arc};
use crate::{ use crate::{
// conversation::{ConversationStore, Convo, Id}, dm::common::{HasConversationId, OutboundSession, SessionRegistry},
conversation::common::{HasConversationId, OutboundSession, SessionRegistry},
errors::ChatError, errors::ChatError,
identity::Identity, identity::Identity,
inbox::Inbox, inbox::Inbox,
@ -122,7 +121,7 @@ impl Context {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::conversation::privatev1::PrivateV1Convo; use crate::dm::privatev1::PrivateV1Convo;
use super::*; 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 prost::{Message, bytes::Bytes};
use crate::{ use crate::{
conversation::common::{HasConversationId, OutboundSession, SessionId}, dm::common::{HasConversationId, OutboundSession, SessionId},
errors::ChatError, errors::ChatError,
types::AddressedEncryptedPayload, types::AddressedEncryptedPayload,
utils::timestamp_millis, utils::timestamp_millis,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,3 +7,14 @@ pub use chat_proto::logoschat::invite::InvitePrivateV1;
pub use prost::Message; pub use prost::Message;
pub use prost::bytes::Bytes; 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())
}
}