all: use syncs.AtomicValue

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-08-04 10:43:49 -07:00
committed by Maisem Ali
parent b75f81ec00
commit a9f6cd41fd
23 changed files with 97 additions and 101 deletions

View File

@@ -107,3 +107,13 @@ func (k NLPublic) MarshalText() ([]byte, error) {
func (k NLPublic) Verifier() ed25519.PublicKey {
return ed25519.PublicKey(k.k[:])
}
// IsZero reports whether k is the zero value.
func (k NLPublic) IsZero() bool {
return k.Equal(NLPublic{})
}
// Equal reports whether k and other are the same key.
func (k NLPublic) Equal(other NLPublic) bool {
return subtle.ConstantTimeCompare(k.k[:], other.k[:]) == 1
}