Root class

class Root(version, spec_version, expires, keys, roles, consistent_snapshot=None, unrecognized_fields=None)

A container for the signed part of root metadata.

Parameters listed below are 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.

  • keys (Dict[str, Key]) – Dictionary of keyids to Keys. Defines the keys used in ‘roles’.

  • roles (Dict[str, Role]) – Dictionary of role names to Roles. Defines which keys are required to sign the metadata for a specific role.

  • consistent_snapshot (Optional[bool]) – Does repository support consistent snapshots.

  • unrecognized_fields (Optional[Mapping[str, Any]]) – Dictionary of all unrecognized fields.

add_key(role, key)

Adds new signing key for delegated role ‘role’.

Raises

ValueError – If ‘role’ doesn’t exist.

Parameters
  • role (str) –

  • key (Key) –

Return type

None

remove_key(role, keyid)

Removes key from ‘role’ and updates the key store.

Raises

ValueError – If ‘role’ doesn’t exist or if ‘role’ doesn’t include the key.

Parameters
  • role (str) –

  • keyid (str) –

Return type

None