diff --git a/pkg/wireguard/keys.go b/pkg/wireguard/keys.go index c6acea0..d6d9080 100644 --- a/pkg/wireguard/keys.go +++ b/pkg/wireguard/keys.go @@ -89,8 +89,25 @@ func decodeKey(data string, size int) ([]byte, error) { } } +func NewPrivateKey() (PrivateKey, error) + +func (PrivateKey) Public() PublicKey + // KeyPair holds a Key pair type KeyPair struct { PrivateKey PrivateKey PublicKey PublicKey } + +func NewKeyPair() (*KeyPair, error) { + key, err := NewPrivateKey() + if err != nil { + return nil, err + } + + out := &KeyPair{ + PrivateKey: key, + PublicKey: key.Public(), + } + return out, nil +}