pub struct WgKeypair { /* private fields */ }Expand description
WireGuard keypair for a PKC node.
The private key is 32 bytes of random data on Curve25519. The public key is the corresponding X25519 public key. The public key is announced via mDNS so peers can establish tunnels.
Implementations§
Source§impl WgKeypair
impl WgKeypair
Sourcepub fn from_seed(seed: &[u8; 32]) -> Self
pub fn from_seed(seed: &[u8; 32]) -> Self
Generate a WireGuard keypair from a deterministic 32-byte seed.
Used for testing — production code should use generate().
Sourcepub fn public_key_hex(&self) -> String
pub fn public_key_hex(&self) -> String
Returns the public key as a 64-character hex string for mDNS announcement.
Sourcepub fn private_key_hex(&self) -> String
pub fn private_key_hex(&self) -> String
Returns the private key as a 64-character hex string. Used for debugging and testing only — never log or expose in production.
Sourcepub fn public_key_bytes(&self) -> &[u8; 32]
pub fn public_key_bytes(&self) -> &[u8; 32]
Returns the raw 32-byte public key.
Sourcepub fn private_key_bytes(&self) -> &[u8; 32]
pub fn private_key_bytes(&self) -> &[u8; 32]
Returns the raw 32-byte private key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WgKeypair
impl<'de> Deserialize<'de> for WgKeypair
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for WgKeypair
impl Freeze for WgKeypair
impl RefUnwindSafe for WgKeypair
impl Send for WgKeypair
impl Sync for WgKeypair
impl Unpin for WgKeypair
impl UnsafeUnpin for WgKeypair
impl UnwindSafe for WgKeypair
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