Skip to content

refactor Metadata._get_role_and_keys() #2272

@jku

Description

@jku

EDIT: This relates to code in #2165 -- should likely be fixed in that PR

Looking at Metadata._get_role_and_keys() after a while... I did not do a good job of it.

Potential improvement:

  • it should return only the keys for the delegated role (instead of all delegated keys and the specific Role). I was probably avoiding unnecessary allocations here but this makes the code harder to read
  • does not have to return the whole role but does have to return threshold instead
  • the method should be public as it's useful in applications as well
  • these changes mean some changes in verify_delegate()

Something like this

    def get_keys_and_threshold(self, delegated_role: str) -> Tuple[List[Key], int]:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions