formats icon indicating copy to clipboard operation
formats copied to clipboard

cms builders: infallible methods with `Result<_>` return type

Open RickyDaMa opened this issue 6 months ago • 0 comments

I'm only working with SignedData & SignerInfo, I haven't checked the other builders, but these methods are all infallible, why do they return Result<_>?

  • SignedDataBuilder::add_digest_algorithm
  • SignedDataBuilder::add_certificate
  • SignedDataBuilder::add_crl
  • SignerInfoBuilder::new
  • SignerInfoBuilder::add_signed_attribute
  • SignerInfoBuilder::add_unsigned_attribute

Would you be open to returning the unwrapped types? The current approach strikes me as unnecessary, and creates a lot of boilerplate in my specific use case where I'm using anyhow to catch errors, which relies on the std/core Error trait for ? coercion (not implemented on v0.2, though I can see it in the v0.3 prereleases).

Despite opening a few issues on this repo in a relatively short timeframe, I'd like to emphasise that my experience across several of the RustCrypto crates has been overwhelmingly positive! Everything I've wanted to do has an API/trait, has felt ergonomic, and has worked once it's compiled ❤️

RickyDaMa avatar Aug 07 '25 16:08 RickyDaMa