MetaFile is missing from_bytes() or equivalent #1893
Labels
backlog
Issues to address with priority for current development goals
enhancement
good first issue
Bite-sized items for first time contributors
We already have
TargetFile.from_data() / TargetFile.from_file()
to calculate hashes and length for a target.We should optionally support hashes and length for Metafile too (but likely the API is not same, see below).
This hasn't come up so far because we haven't really used the optional hashes in our metafiles... it did come up in theupdateframework/go-tuf#228.
Notes:
TargetFile.from_data()
can be shared somehowMetaFile
needs version that comes from aMetadata
-- obviously the implementation could parse the bytes it gets to construct Metadata... but that's not ideal because we can expect the Metadata is already in memory, reparsing is wasteful. The go-tuf generator code is a fine example of this.MetaFile
only needs version: the API should not automatically lead to using hashespotential API (maybe add
from_file()
too to be consistent):This is consistent with TargetFile, but looks a bit odd: it's called
from_data()
but data argument can be None? Maybe data should not be optional: we should just document thatMetafile.from_data(ver, data)
constructor should only be used if hashes are wanted, by defaultMetaFile(ver)
should be used.The text was updated successfully, but these errors were encountered: