mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-02-13 02:13:06 +00:00
* Load orginal protofiles * Change package name * Add prost generation * Remove placeholders * Add generated files + imports * replace with chat-proto * Add XK0 * auto formatting * Initial implementation of PrivateV1 initialization * Add ConvoFactory trait * Hook up indentity placeholder * Remove RemoteInbox until it’s needed * Simplify Identity ownership * Clean up x3handshake * Move inbox encryption * Simplify inbox encryption * Cleanup warnings * Add todos * Update chat-proto crate * Publickey Handling * Reorg Inbox handshake * Update Inbox convoId * Remove file structure headers * Update ConvoID * Add Domain Separator trait * Remove Convo trait functions * Rename Context * Add SecretKey * Add workspace dependency * update KE name * Update comments for clarity * Remove Xk0 references * Bump chat_proto version and relock
32 lines
714 B
Rust
32 lines
714 B
Rust
use std::fmt::Debug;
|
|
|
|
pub use generic_array::{GenericArray, typenum::U32};
|
|
use zeroize::{Zeroize, ZeroizeOnDrop};
|
|
|
|
#[derive(Clone, Zeroize, ZeroizeOnDrop, PartialEq)]
|
|
pub struct SecretKey([u8; 32]);
|
|
|
|
impl SecretKey {
|
|
pub fn as_bytes(&self) -> &[u8] {
|
|
self.0.as_slice()
|
|
}
|
|
}
|
|
|
|
impl From<[u8; 32]> for SecretKey {
|
|
fn from(value: [u8; 32]) -> Self {
|
|
SecretKey(value)
|
|
}
|
|
}
|
|
|
|
impl From<GenericArray<u8, U32>> for SecretKey {
|
|
fn from(value: GenericArray<u8, U32>) -> Self {
|
|
SecretKey(value.into())
|
|
}
|
|
}
|
|
|
|
impl Debug for SecretKey {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.debug_tuple("SecretKey").field(&"<32 bytes>").finish()
|
|
}
|
|
}
|