Help us shape the future of Go! Take the 2026 Go Developer Survey

wgkey

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package wgkey handles WireGuard Curve25519 keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key [32]byte

Key is a 32-byte WireGuard key.

func FromBytes

func FromBytes(b []byte) (Key, error)

FromBytes copies a 32-byte slice into a Key.

func NewPrivate

func NewPrivate() (Key, error)

NewPrivate returns a new, clamped private key.

func Parse

func Parse(s string) (Key, error)

Parse decodes a base64 key.

func ParseHex

func ParseHex(s string) (Key, error)

ParseHex decodes a hex key as returned by the UAPI.

func (Key) Bytes

func (k Key) Bytes() []byte

Bytes returns a copy of the key as a slice.

func (Key) Hex

func (k Key) Hex() string

Hex returns the hex encoding used by the UAPI configuration protocol.

func (Key) IsZero

func (k Key) IsZero() bool

IsZero reports whether k is all zeros.

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (base64).

func (Key) Public

func (k Key) Public() Key

Public derives the public key from a private key.

func (Key) String

func (k Key) String() string

String returns the standard base64 encoding used by wg(8).

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler (base64).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL