Browse Source

wireguard: introduce BinaryKey.Equal()

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/1/head
Alejandro Mery 10 months ago
parent
commit
0de2e3f4d9
  1. 6
      pkg/wireguard/keys.go

6
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) {

Loading…
Cancel
Save