wireguard: WIP

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-22 23:54:39 +00:00
parent 34f0b910c8
commit 7b8f46fd7f
+17
View File
@@ -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
}