pub struct WgKeypair {
pub private: StaticSecret,
pub public: PublicKey,
}Expand description
A WireGuard static keypair (Curve25519).
private is the peer’s long-term secret; public is what you publish so other peers
can address you. Both are the x25519_dalek types that boringtun itself consumes, so
they hand straight to new_tunnel/[Tunn::new] with no conversion.
Fields§
§private: StaticSecret§public: PublicKeyImplementations§
Source§impl WgKeypair
impl WgKeypair
Sourcepub fn from_secret_bytes(secret: [u8; 32]) -> WgKeypair
pub fn from_secret_bytes(secret: [u8; 32]) -> WgKeypair
Reconstruct a keypair from a 32-byte Curve25519 secret (e.g. loaded from the vault). The public key is derived deterministically from the secret.
Sourcepub fn private_bytes(&self) -> [u8; 32]
pub fn private_bytes(&self) -> [u8; 32]
The 32 raw bytes of the secret key (for serialization into the key vault).
Sourcepub fn public_bytes(&self) -> [u8; 32]
pub fn public_bytes(&self) -> [u8; 32]
The 32 raw bytes of the public key.
Sourcepub fn public_hex(&self) -> String
pub fn public_hex(&self) -> String
This keypair’s public key rendered as lowercase hex (see public_key_hex).
Auto Trait Implementations§
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§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more