python-tuf icon indicating copy to clipboard operation
python-tuf copied to clipboard

repository: maybe provide a Repository.get_delegating_role()

Open jku opened this issue 1 year ago • 2 comments

I wonder if Repository.get_delegating_role(role: str) -> str would be useful

  • In my implementations I end up looking up the delegating role of a role quite a lot.
  • if this existed, Repository could also offer QOL things like Repository.get_verification_result(role, md)

The reason this does not exist is that we can't really provide a fully generic implementation: Repository does not maintain a delegation tree. So we could

  • Require all Repository implementations to provide the method OR
  • Provide a default implementation that assumes max one level of targets delegations (and require more complex implementations to provide their own) OR
  • Provide a default implementation that adds a delegation tree into Repository

jku avatar Feb 04 '24 09:02 jku

Oh this is going to be a nightmare if we allow "diamond" delegation structure (mutliple roles in different delegating metadata delegating to same name)

jku avatar Feb 09 '24 13:02 jku

cc #660

lukpueh avatar Feb 12 '24 08:02 lukpueh