-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try constructor improvements for Delegations/ delegated roles #2071
Comments
If we use the first approach:
we would have to:
If we use the second approach:
we would have to:
There is a third option I just came up with:
we would have to:
I think I am in favor of the third option as I don't like the idea of adding new methods and also it seems the simplest to use. PS: I was thinking if we can remove the PS2: I considered moving |
After I tried implementing the third option I realized that the end result was complicated as actually I had to initialize delegations like this: targets.signed.delegations = Delegations(
succinct_roles=SuccinctRoles(
bit_length=NUMBER_OF_BINS, name_prefix=NAME_PREFIX
)
)
targets.add_key(bins_key) It required 4 lines just to initialize the targets.delegations as we use black. Then, I tried the first option as it seemed like a good balance - we were creating a new method, yes, but inside |
Thanks that was useful. Looking at this again now, I don't think pushing these ergonomy helpers deep down the hierarchy is good: users don't want to dig through Metadata docs, then Targets docs, then through Delegations docs just to find "SuccinctRoles" -- they just want to create Metadata with succinct delegations. Helper classes should be implementation details as much as possible. I think we should move helpers as high in the chain as it makes sense: I think in this case it's Delegations (because Targets contains both delegations and targetfiles so we should tell users to create a new Targets to change delegations), so:
or during construction
it's still pretty ugly and undiscoverable but I'd say better |
Currently creating e.g. succinct delegations looks like this
Looks bad, i'm sure we could get that to something a bit like:
Or alternatively
What makes sense probably depends on what the other delegation types (most importantly paths delegation) will look like...
The text was updated successfully, but these errors were encountered: