diff --git a/pkg/wireguard/keys.go b/pkg/wireguard/keys.go index faa8a33..12bf58e 100644 --- a/pkg/wireguard/keys.go +++ b/pkg/wireguard/keys.go @@ -1,6 +1,7 @@ package wireguard import ( + "bytes" "encoding/base64" ) @@ -16,6 +17,11 @@ func (k BinaryKey) IsZero() bool { return len(k) == 0 } +// Equal checks if two keys are identical +func (k BinaryKey) Equal(alter BinaryKey) bool { + return bytes.Equal(k, alter) +} + // BinaryKeyFromBase64 decodes a base64-based string into // a [BinaryKey] func BinaryKeyFromBase64(data string) (BinaryKey, error) {