@@ -25,6 +25,7 @@ const (
2525 typeRemotePublicKey tlv.Type = 11
2626 typeMacaroonRecipe tlv.Type = 12
2727 typeCreatedAt tlv.Type = 13
28+ typeRevokedAt tlv.Type = 14
2829
2930 // typeMacaroon is no longer used, but we leave it defined for backwards
3031 // compatibility.
@@ -58,8 +59,13 @@ func SerializeSession(w io.Writer, session *Session) error {
5859 pairingSecret = session .PairingSecret [:]
5960 privateKey = session .LocalPrivateKey .Serialize ()
6061 createdAt = uint64 (session .CreatedAt .Unix ())
62+ revokedAt uint64
6163 )
6264
65+ if ! session .RevokedAt .IsZero () {
66+ revokedAt = uint64 (session .RevokedAt .Unix ())
67+ }
68+
6369 if session .DevServer {
6470 devServer = 1
6571 }
@@ -103,6 +109,7 @@ func SerializeSession(w io.Writer, session *Session) error {
103109
104110 tlvRecords = append (
105111 tlvRecords , tlv .MakePrimitiveRecord (typeCreatedAt , & createdAt ),
112+ tlv .MakePrimitiveRecord (typeRevokedAt , & revokedAt ),
106113 )
107114
108115 tlvStream , err := tlv .NewStream (tlvRecords ... )
@@ -117,12 +124,12 @@ func SerializeSession(w io.Writer, session *Session) error {
117124// the data to be encoded in the tlv format.
118125func DeserializeSession (r io.Reader ) (* Session , error ) {
119126 var (
120- session = & Session {}
121- label , serverAddr []byte
122- pairingSecret , privateKey []byte
123- state , typ , devServer uint8
124- expiry , createdAt uint64
125- macRecipe MacaroonRecipe
127+ session = & Session {}
128+ label , serverAddr []byte
129+ pairingSecret , privateKey []byte
130+ state , typ , devServer uint8
131+ expiry , createdAt , revokedAt uint64
132+ macRecipe MacaroonRecipe
126133 )
127134 tlvStream , err := tlv .NewStream (
128135 tlv .MakePrimitiveRecord (typeLabel , & label ),
@@ -144,6 +151,7 @@ func DeserializeSession(r io.Reader) (*Session, error) {
144151 macaroonRecipeEncoder , macaroonRecipeDecoder ,
145152 ),
146153 tlv .MakePrimitiveRecord (typeCreatedAt , & createdAt ),
154+ tlv .MakePrimitiveRecord (typeRevokedAt , & revokedAt ),
147155 )
148156 if err != nil {
149157 return nil , err
@@ -162,6 +170,10 @@ func DeserializeSession(r io.Reader) (*Session, error) {
162170 session .ServerAddr = string (serverAddr )
163171 session .DevServer = devServer == 1
164172
173+ if revokedAt != 0 {
174+ session .RevokedAt = time .Unix (int64 (revokedAt ), 0 )
175+ }
176+
165177 if t , ok := parsedTypes [typeMacaroonRecipe ]; ok && t == nil {
166178 session .MacaroonRecipe = & macRecipe
167179 }
0 commit comments