mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
types/key: add IsZero methods
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
3878f0a67a
commit
a6c695ba6b
@ -10,6 +10,9 @@
|
|||||||
// Private represents a curve25519 private key.
|
// Private represents a curve25519 private key.
|
||||||
type Private [32]byte
|
type Private [32]byte
|
||||||
|
|
||||||
|
// Private reports whether p is the zero value.
|
||||||
|
func (p Private) IsZero() bool { return p == Private{} }
|
||||||
|
|
||||||
// B32 returns k as the *[32]byte type that's used by the
|
// B32 returns k as the *[32]byte type that's used by the
|
||||||
// golang.org/x/crypto packages. This allocates; it might
|
// golang.org/x/crypto packages. This allocates; it might
|
||||||
// not be appropriate for performance-sensitive paths.
|
// not be appropriate for performance-sensitive paths.
|
||||||
@ -18,6 +21,9 @@ func (k Private) B32() *[32]byte { return (*[32]byte)(&k) }
|
|||||||
// Public represents a curve25519 public key.
|
// Public represents a curve25519 public key.
|
||||||
type Public [32]byte
|
type Public [32]byte
|
||||||
|
|
||||||
|
// Public reports whether p is the zero value.
|
||||||
|
func (p Public) IsZero() bool { return p == Public{} }
|
||||||
|
|
||||||
// B32 returns k as the *[32]byte type that's used by the
|
// B32 returns k as the *[32]byte type that's used by the
|
||||||
// golang.org/x/crypto packages. This allocates; it might
|
// golang.org/x/crypto packages. This allocates; it might
|
||||||
// not be appropriate for performance-sensitive paths.
|
// not be appropriate for performance-sensitive paths.
|
||||||
|
Loading…
Reference in New Issue
Block a user