wireguard: introduce BinaryKey.Equal()

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-22 18:56:53 +00:00
parent c92873f07d
commit 0de2e3f4d9
+6
View File
@@ -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) {