Documentation ¶
Overview ¶
Package wgkey contains types and helpers for WireGuard keys. It is very similar to package tailscale.com/types/key, which is also used for curve25519 keys. These keys are used for WireGuard clients; those keys are used in other curve25519 clients.
Index ¶
- Constants
- type Key
- func (k Key) Base64() string
- func (k Key) Equal(k2 Key) bool
- func (k Key) HexString() string
- func (k *Key) IsZero() bool
- func (a *Key) LessThan(b *Key) bool
- func (k Key) MarshalJSON() ([]byte, error)
- func (k *Key) ShortString() string
- func (k Key) String() string
- func (k *Key) UnmarshalJSON(b []byte) error
- type Private
- type Symmetric
Constants ¶
const Size = 32
Size is the number of bytes in a curve25519 key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
A Key is a curve25519 key. It is used by WireGuard to represent public and preshared keys.
func (Key) MarshalJSON ¶
func (*Key) ShortString ¶
func (*Key) UnmarshalJSON ¶
type Private ¶
A Private is a curve25519 key. It is used by WireGuard to represent private keys.
func NewPrivate ¶
NewPrivate generates a new curve25519 secret key. It conforms to the format described on https://cr.yp.to/ecdh.html.
func ParsePrivate ¶
func ParsePrivateHex ¶
func (Private) MarshalText ¶
func (*Private) UnmarshalText ¶
type Symmetric ¶
type Symmetric [chacha20poly1305.KeySize]byte
Symmetric is a chacha20poly1305 key. It is used by WireGuard to represent pre-shared symmetric keys.