wireguard: introduce BinaryKey.Equal()
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package wireguard
|
package wireguard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,6 +17,11 @@ func (k BinaryKey) IsZero() bool {
|
|||||||
return len(k) == 0
|
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
|
// BinaryKeyFromBase64 decodes a base64-based string into
|
||||||
// a [BinaryKey]
|
// a [BinaryKey]
|
||||||
func BinaryKeyFromBase64(data string) (BinaryKey, error) {
|
func BinaryKeyFromBase64(data string) (BinaryKey, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user