types/key: add IsZero methods
// Private represents a curve25519 private key.
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
// golang.org/x/crypto packages. This allocates; it might
// 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.
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
// golang.org/x/crypto packages. This allocates; it might
// not be appropriate for performance-sensitive paths.
