pub struct EphemeralKeyPair { /* private fields */ }Expand description
An ephemeral X25519 keypair for one pair-session. Caller must persist the secret locally (we never put it on the wire) and publish the public via PairingRequested / PairingConfirmed.
When the pair ends, drop this struct (and any local copies of
secret_hex) to honor forward secrecy.
Implementations§
Source§impl EphemeralKeyPair
impl EphemeralKeyPair
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh ephemeral keypair from the OS RNG. One per pair-session; do NOT reuse across pairs (no advantage, and any reuse weakens the forward-secrecy claim).
pub fn public_bytes(&self) -> [u8; 32]
Sourcepub fn secret_hex(&self) -> String
pub fn secret_hex(&self) -> String
32-byte secret as hex for local persistence. Endpoint implementations save this alongside their PairState; wipe the file when the pair is revoked.
pub fn public_hex(&self) -> String
Sourcepub fn from_secret_hex(s: &str) -> Result<Self>
pub fn from_secret_hex(s: &str) -> Result<Self>
Reconstruct from a secret hex string (matched output of
secret_hex). Errors on bad hex or wrong length.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EphemeralKeyPair
impl RefUnwindSafe for EphemeralKeyPair
impl Send for EphemeralKeyPair
impl Sync for EphemeralKeyPair
impl Unpin for EphemeralKeyPair
impl UnsafeUnpin for EphemeralKeyPair
impl UnwindSafe for EphemeralKeyPair
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