Documentation ¶
Index ¶
Constants ¶
const F_GenKey = "wggenkey"
const F_PubKey = "wgpublickey"
const KeyLen = 32 // wgh.KeyLen
KeyLen is the expected key length for a WireGuard key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
A Key is a public, private, or pre-shared secret key. The Key constructor functions in this package can be used to create Keys suitable for each of these applications.
func GenerateKey ¶
GenerateKey generates a Key suitable for use as a pre-shared secret key from a cryptographically safe source.
The output Key should not be used as a private key; use GeneratePrivateKey instead.
func GeneratePrivateKey ¶
GeneratePrivateKey generates a Key suitable for use as a private key from a cryptographically safe source.
func NewKey ¶
NewKey creates a Key from an existing byte slice. The byte slice must be exactly 32 bytes in length.
func ParseKey ¶
ParseKey parses a Key from a base64-encoded string, as produced by the Key.String method.