Timestamp class
- class Timestamp(version, spec_version, expires, snapshot_meta, unrecognized_fields=None)
A container for the signed part of timestamp metadata.
TUF file format uses a dictionary to contain the snapshot information: this is not the case with
Timestamp.snapshot_meta
which is aMetaFile
.All parameters named below are not just constructor arguments but also instance attributes.
- Parameters
version (int) – Metadata version number.
spec_version (str) – Supported TUF specification version number.
expires (datetime.datetime) – Metadata expiry date.
unrecognized_fields (Optional[Mapping[str, Any]]) – Dictionary of all attributes that are not managed by TUF Metadata API
snapshot_meta (MetaFile) – Meta information for snapshot metadata.
- Raises
ValueError – Invalid arguments.
- property expires: datetime.datetime
The metadata expiry date:
# Use 'datetime' module to e.g. expire in seven days from now obj.expires = utcnow() + timedelta(days=7)
- is_expired(reference_time=None)
Checks metadata expiration against a reference time.
- Parameters
reference_time (Optional[datetime.datetime]) – Time to check expiration date against. A naive datetime in UTC expected. Default is current UTC date and time.
- Returns
True
if expiration time is less than the reference time.- Return type
bool