Timestamp class
- class Timestamp(version=None, spec_version=None, expires=None, snapshot_meta=None, 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 | None) – Metadata version number. Default is 1.
spec_version (str | None) – Supported TUF specification version. Default is the version currently supported by the library.
expires (datetime | None) – Metadata expiry date. Default is current date and time.
unrecognized_fields (dict[str, Any] | None) – Dictionary of all attributes that are not managed by TUF Metadata API
snapshot_meta (MetaFile | None) – Meta information for snapshot metadata. Default is a MetaFile with version 1.
- Raises:
ValueError – Invalid arguments.
- property expires: datetime
Get the metadata expiry date.
- is_expired(reference_time=None)
Check metadata expiration against a reference time.
- Parameters:
reference_time (datetime | None) – 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