You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While implementing changes on LocalKeyVault, @MVrachev raised an interesting comment that it greatly improved how our backend services use the configurations.
The first change required is to change ÌKeyVaultandIStorageinrepository_services_tuf_worker.interfaces.py`
IKeyVault should return List["IKeyVault"] what will be List[{NAME}KeyVault] i.e. List[LocalKeyVault] IStorage should return IStorage what will be in the services '{NAME}Storage i.e. LocalStorage
Where {NAME} will be the defined name for the storage.
On the implementation of the services, we use the class method configure to return our object with all checks and settings done.
In that way, the services I{Service}.__init__() will store the required fields validated and configured.
In the repository_services_tuf_worker.repository.MetadataRepository, we change the refresh_settings to instantiate the objects using the class method configure instead of the class itself
The text was updated successfully, but these errors were encountered:
kairoaraujo
changed the title
Refactoring: interfaces, refresh_settings` and services
Refactoring: interfaces, refresh_settings and services
May 11, 2023
While implementing changes on
LocalKeyVault
, @MVrachev raised an interesting comment that it greatly improved how our backend services use the configurations.The first change required is to change ÌKeyVault
and
IStoragein
repository_services_tuf_worker.interfaces.py`IKeyVault
should returnList["IKeyVault"]
what will beList[{NAME}KeyVault]
i.e.List[LocalKeyVault]
IStorage
should returnIStorage
what will be in the services'{NAME}Storage
i.e.LocalStorage
Where
{NAME}
will be the defined name for the storage.On the implementation of the services, we use the class method
configure
to return our object with all checks and settings done.In that way, the services
I{Service}.__init__()
will store the required fields validated and configured.In the
repository_services_tuf_worker.repository.MetadataRepository
, we change therefresh_settings
to instantiate the objects using the class method configure instead of the class itselfExample:
instead
Original comment:
I think it would be useful to have a similar function as
from_dict
for the Signed classes in TUF: https://github.com/theupdateframework/python-tuf/blob/eff842201e7bbb3817958dc242f21031766ab2b9/tuf/api/metadata.py#L737There I imagine you will set up the path by calling
_base_64_key
, then also we can call_raw_key_parser
to parse the key and we can have an init where it will accept a list ofLocalKey
objects.This way we would access the online key as many times as we would without doing the parsing again and again in
LocalKeyVault.get()
.Originally posted by @MVrachev in #283 (comment)
The text was updated successfully, but these errors were encountered: