Struct wgctrl_rs::Key[][src]

pub struct Key(pub wg_key);

Represents a WireGuard encryption key.

WireGuard makes no meaningful distinction between public, private and preshared keys - any sequence of 32 bytes can be used as either of those.

This means that you need to be careful when working with Keys, especially ones created from external data.

Methods

impl Key
[src]

Creates a new Key from raw bytes.

Generates and returns a new private key.

Generates and returns a new preshared key.

Generates a public key for this private key.

Generates an all-zero key.

Checks if this key is all-zero.

Converts the key to a standardized base64 representation, as used by the wg utility and wg-quick.

Converts a base64 representation of the key to the raw bytes.

This can fail, as not all text input is valid base64 - in this case Err(InvalidKey) is returned.

Trait Implementations

impl PartialEq for Key
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Key
[src]

impl Clone for Key
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Key
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Key

impl Sync for Key