types/key: add IsZero method to HardwareAttestationKey (#17370)

We will need this for unmarshaling node prefs: use the zero
HardwareAttestationKey implementation when parsing and later check
`IsZero` to see if anything was loaded.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
pull/17373/head
Andrew Lytvynov 2 months ago committed by GitHub
parent be6cfa00cb
commit 840c7668e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -262,3 +262,5 @@ func (ak *attestationKey) Clone() key.HardwareAttestationKey {
pub: ak.pub, pub: ak.pub,
} }
} }
func (ak *attestationKey) IsZero() bool { return !ak.loaded() }

@ -32,6 +32,7 @@ type HardwareAttestationKey interface {
json.Unmarshaler json.Unmarshaler
io.Closer io.Closer
Clone() HardwareAttestationKey Clone() HardwareAttestationKey
IsZero() bool
} }
// HardwareAttestationPublicFromPlatformKey creates a HardwareAttestationPublic // HardwareAttestationPublicFromPlatformKey creates a HardwareAttestationPublic

Loading…
Cancel
Save