Skip to main content

EphemeralKey

Struct EphemeralKey 

Source
pub struct EphemeralKey { /* private fields */ }
Expand description

Ephemeral X25519 keypair for one feed handshake.

Implementations§

Source§

impl EphemeralKey

Source

pub fn generate() -> Result<Self>

Generate a fresh X25519 keypair from the OS CSPRNG.

Source

pub fn public_bytes(&self) -> [u8; 32]

32-byte X25519 public key sent in enc/1=<64-hex>.

Source

pub fn derive_feed_key( self, peer_pk: [u8; 32], is_outlet: bool, psk: Option<&str>, ) -> Result<[u8; 32]>

Complete X25519 key agreement and derive the outlet-to-inlet ChaCha20-Poly1305 session key via HKDF-SHA256.

inlet_pk and outlet_pk are bound into the HKDF salt together with any optional pre-shared key so both sides agree on the exact transcript.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.