pub struct Identity { /* private fields */ }Expand description
A complete cryptographic identity for Phalanx Protocol
Contains both signing keys (Ed25519) and key exchange capabilities (X25519). Private keys are automatically zeroized on drop for security.
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn from_bytes(private_key_bytes: &[u8]) -> Result<Self>
pub fn from_bytes(private_key_bytes: &[u8]) -> Result<Self>
Create identity from existing private key bytes
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Get the public key for this identity
Sourcepub fn private_key(&self) -> PrivateKey
pub fn private_key(&self) -> PrivateKey
Get the private key component
Sourcepub fn generate_kx_key(&mut self) -> X25519PublicKey
pub fn generate_kx_key(&mut self) -> X25519PublicKey
Generate a new ephemeral key exchange secret
Sourcepub fn key_exchange(
&mut self,
other_public: &X25519PublicKey,
) -> Result<[u8; 32]>
pub fn key_exchange( &mut self, other_public: &X25519PublicKey, ) -> Result<[u8; 32]>
Perform key exchange with another party’s public key This consumes the ephemeral secret as diffie_hellman takes ownership
Sourcepub fn static_key_exchange(
&self,
other_public: &X25519PublicKey,
) -> Result<[u8; 32]>
pub fn static_key_exchange( &self, other_public: &X25519PublicKey, ) -> Result<[u8; 32]>
Perform key exchange using static X25519 key derived from signing key This allows consistent key exchange without ephemeral keys
Sourcepub fn static_public_key(&self) -> X25519PublicKey
pub fn static_public_key(&self) -> X25519PublicKey
Get the static X25519 public key derived from signing key
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnwindSafe for Identity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more