@@ -26,6 +26,7 @@ type Persist struct {
2626 UserProfile tailcfg.UserProfile
2727 NetworkLockKey key.NLPrivate
2828 NodeID tailcfg.StableNodeID
29+ AttestationKey key.HardwareAttestationKey `json:",omitempty"`
2930
3031 // DisallowedTKAStateIDs stores the tka.State.StateID values which
3132 // this node will not operate network lock on. This is used to
@@ -84,24 +85,37 @@ func (p *Persist) Equals(p2 *Persist) bool {
8485 return false
8586 }
8687
88+ var pub , p2Pub key.HardwareAttestationPublic
89+ if p .AttestationKey != nil && ! p .AttestationKey .IsZero () {
90+ pub = key .HardwareAttestationPublicFromPlatformKey (p .AttestationKey )
91+ }
92+ if p2 .AttestationKey != nil && ! p2 .AttestationKey .IsZero () {
93+ p2Pub = key .HardwareAttestationPublicFromPlatformKey (p2 .AttestationKey )
94+ }
95+
8796 return p .PrivateNodeKey .Equal (p2 .PrivateNodeKey ) &&
8897 p .OldPrivateNodeKey .Equal (p2 .OldPrivateNodeKey ) &&
8998 p .UserProfile .Equal (& p2 .UserProfile ) &&
9099 p .NetworkLockKey .Equal (p2 .NetworkLockKey ) &&
91100 p .NodeID == p2 .NodeID &&
101+ pub .Equal (p2Pub ) &&
92102 reflect .DeepEqual (nilIfEmpty (p .DisallowedTKAStateIDs ), nilIfEmpty (p2 .DisallowedTKAStateIDs ))
93103}
94104
95105func (p * Persist ) Pretty () string {
96106 var (
97107 ok , nk key.NodePublic
98108 )
109+ akString := "-"
99110 if ! p .OldPrivateNodeKey .IsZero () {
100111 ok = p .OldPrivateNodeKey .Public ()
101112 }
102113 if ! p .PrivateNodeKey .IsZero () {
103114 nk = p .PublicNodeKey ()
104115 }
105- return fmt .Sprintf ("Persist{o=%v, n=%v u=%#v}" ,
106- ok .ShortString (), nk .ShortString (), p .UserProfile .LoginName )
116+ if p .AttestationKey != nil && ! p .AttestationKey .IsZero () {
117+ akString = fmt .Sprintf ("%v" , p .AttestationKey .Public ())
118+ }
119+ return fmt .Sprintf ("Persist{o=%v, n=%v u=%#v ak=%s}" ,
120+ ok .ShortString (), nk .ShortString (), p .UserProfile .LoginName , akString )
107121}
0 commit comments