Targets class
- class Targets(version, spec_version, expires, targets, delegations=None, unrecognized_fields=None)
A container for the signed part of targets metadata.
Targets contains verifying information about target files and also delegates responsibility to other Targets roles.
All parameters named below are not just constructor arguments but also instance attributes.
- Parameters
version (int) – The metadata version number.
spec_version (str) – The supported TUF specification version number.
expires (datetime.datetime) – The metadata expiry date.
targets (Dict[str, TargetFile]) – A dictionary of target filenames to TargetFiles
delegations (Optional[Delegations]) – Defines how this Targets delegates responsibility to other Targets Metadata files.
unrecognized_fields (Optional[Mapping[str, Any]]) – Dictionary of all unrecognized fields.
- Return type
None
- add_key(role, key)
Adds new signing key for delegated role ‘role’.
- Parameters
role (str) – The name of the role, for which ‘key’ is added.
key (Key) – The signing key to be added for ‘role’.
- Raises
ValueError – If there are no delegated roles or if ‘role’ is not delegated by this Target.
- Return type
None
- remove_key(role, keyid)
Removes key from delegated role ‘role’ and updates the delegations key store.
- Parameters
role (str) – The name of the role, for which a signing key is removed.
key – The identifier of the key to be removed for ‘role’.
keyid (str) –
- Raises
ValueError – If there are no delegated roles or if ‘role’ is not delegated by this Target or if key is not used by ‘role’.
- Return type
None
- update(fileinfo)
Assigns passed target file info to meta dict.
- Parameters
fileinfo (TargetFile) –
- Return type
None