rust-tuf
rust-tuf copied to clipboard
Cleaning up API surface before releasing 0.3.0
We're getting close to releasing 0.3.0. Are there any other papercuts on the API surface we want to clean up before release? Here are some ideas:
- [ ]
MetadataPathandTargetPathown aString, but are mainly passed around as a reference. Should we instead replicate std::path::Path and use a dynamically sized type? Downside of this is that we'd have to useunsafein order to construct these values. - [ ] Should we create
client::ClientBuilderand move theclient::Configinto it? Then people who just want the default wouldn't have to deal with passing aroundConfig::default(). - [ ] The TUF spec refers to different formats as "POUFs". Should we rename
tuf::interchangetotuf::pouf, andtuf::interchange::Jsontotuf::pouf::Pouf1? - [ ] Should we get rid of the
HashAlgorithmenum, and use adyn HashAlgorithminstead? That might allow better customization of the hash algorithm type. - [ ] Should we drop support for the legacy
hash_key_algorithm? - [ ] The tuf::error::Error is a little messy. Is there a better way to clean it up?
- [ ] should tuf::verify::verify_signature be public?
- [ ] Change TargetsMetadata to store targets in a BTreeMap rather than a HashMap to make ordering stable.
Misc. notes below from a cursory read without actually using the library, so reader beware.
Re: ideas in issue
MetadataPathandTargetPath: There's a lot of reflexive revulsion against libraries that useunsafe, fair or not. IMO in a security-focused library it's not worth the consternation.- +1 to
ClientBuilder - +1 to
tuf::pouf, maybe aliastuf::pouf::Pouf1totuf::pouf::Cjson? verify_signaturepublic? I don't see a need for it.
High-level
- Would be nice to have more direction towards what a user would actually want to use.
- E.g. quickstart, more examples, re-exporting important structs/traits at the top level
- Or an overview of how the parts fit together.
- What's a store vs. a database vs. a repository? IME every TUF library suffers from this confusion, so don't consider it a criticism.
Databaseis kind of a funny name but not sure what else to call it
- How do you go from zero to root keys setup? a la https://blog.sigstore.dev/sigstore-bring-your-own-stuf-with-tuf-40febfd2badd
- could be a nice quickstart
Nitpicks/idle thoughts/bikeshedding (feel free to totally ignore)
ThingToBuild::build()/Builder::finish()as methods are a little surprising to me vs.ThingToBuild::builder()/Builder::build()repo_builder::RepoBuilder->repository::MetadataBuilder?RepoBuilder::create->RepoBuilder::new? Is there a reason for calling it one vs. the other?- Implement
EphemeralRepository::new()in terms ofEphemeralRepository::default()? Delegations::new(HashMap<KeyId, Key>, Vec<Delegation>)- IIRC
chronois more-or-less unmaintained and it's generally better to prefertime-rs: https://github.com/chronotope/chrono/issues/602 RepositoryProvider->RepositoryReaderetc.?- Lots of API stutter:
repository::RepositoryStorageetc. I know this is not totally a settled issue in Rust but I tend to preferrepository::Storageor evenrepo::Storage
Positives
- Overall looks great! Very thoughtfully designed
- Love the in-memory implementations! Really makes great tests and docs.
- Like the
Verifiedwrapper a lot.