@@ -130,15 +130,21 @@ def write_to_json(self, filename: str) -> None:
130
130
131
131
class Timestamp (Metadata ):
132
132
def __init__ (self , consistent_snapshot : bool = True , expiration : relativedelta = relativedelta (days = 1 ), keyring : Keyring = None , version : int = 1 ):
133
- super ().__init__ (consistent_snapshot , expiration , relativedelta , keyring , version )
133
+ super ().__init__ (consistent_snapshot , expiration , keyring , version )
134
134
135
- # FIXME
136
135
def signable (self ):
137
- return generate_timestamp_metadata ()
136
+ expires = self .expiration .replace (tzinfo = None ).isoformat ()+ 'Z'
137
+ filedict = self .signed ['meta' ]
138
+ return tuf .formats .build_dict_conforming_to_schema (
139
+ tuf .formats .TIMESTAMP_SCHEMA , version = self .version ,
140
+ expires = expires , meta = filedict )
138
141
139
142
# Update metadata about the snapshot metadata.
140
143
def update (self , rolename : str , version : int , length : int , hashes : JsonDict ):
141
- raise NotImplementedError ()
144
+ fileinfo = self .signed ['meta' ][f'{ rolename } .json' ]
145
+ fileinfo ['version' ] = version
146
+ fileinfo ['length' ] = length
147
+ fileinfo ['hashes' ] = hashes
142
148
143
149
class Snapshot (Metadata ):
144
150
def __init__ (self , consistent_snapshot : bool = True , expiration : relativedelta = relativedelta (days = 1 ), keyring : Keyring = None , version : int = 1 ):
0 commit comments