-
Notifications
You must be signed in to change notification settings - Fork 122
Unbundle params from output types #328
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
Conversation
I like this one better than #326, but not sure if it has some negative consequences if the params are not available for |
The caller could always bundle up the params and the |
@est31 sorry, I just pushed a bunch more stuff -- will stop here and let you take another look. |
74e48d2
to
9e88850
Compare
I set my project to use After a few updates I was able to successfully sign using a mock Key Vault. I'm working on confirming with the real Azure Key Vault. |
I'll give this a review by EOW. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a nice improvement.
One of the two CI failures will be fixed with a rebase to pick up the version bump in main
. The other is a real doctest issue:
---- rcgen\src\crl.rs - crl::CertificateRevocationList (line 23) stdout ----
error[E0407]: method `public_key` is not a member of trait `SigningKey`
--> rcgen\src\crl.rs:31:3
|
9 | fn public_key(&self) -> &[u8] { &self.public_key }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `SigningKey`
error[E0407]: method `algorithm` is not a member of trait `SigningKey`
--> rcgen\src\crl.rs:33:3
|
11 | fn algorithm(&self) -> &'static SignatureAlgorithm { &PKCS_ED25519 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `SigningKey`
It seems like the doctest in question is more complicated than it needs to be in order to work around builds without crypto
enabled.
WDYT about simplifying that example to avoid all the key pair trait stuff and just configuring the docs build to have the required feature? IMO the example is better when it focuses on the CRL bits and avoids a dummy remote key pair.
cc9ce2b
to
8ea0913
Compare
do we have examples with dummy remote key pairs? We should at least have some example. |
I kept the existing example which demonstrates both, I think? |
6395fec
to
2887998
Compare
That's fine, @cpu was suggesting to remove that usage from the crl example. In any case, wondering about the reasons behind the inverting of the I chose the old hierarchy because felt to me that it occurs less often that you want to use a I'm not saying we shouldn't do it, but want to hear arguments :). |
@djc what do you envision for that API? just that I know which direction we are walking in. |
Basically, I think that it simplies the code. A bunch of public API unnecessarily took a
I'm envisioning something like |
Yeah exactly, I think it's best to try to keep it one concept per example. If we don't have a separate example showing implementing the trait then I'd be 👍 to adding that with the bits removed from the CRL example. I can take a crack at this as a follow-up if folks agree on the direction. No need to block this PR since it's a pre-existing example. |
@est31 I'll await your acknowledgement of my last comment before merging, let me know. 👍 |
It still works but if you try to write new code that uses the library, each trait is another point of friction: you need to look up implementations of that trait and which one is good for you. It's better to be economic with traits, and the old hierarchy ensured that only people who really needed the trait needed to learn about it (most people don't). Still, I think the change is good overall as it gives a little bit more flexibility (esp wrt stuff like
The name would probably need to be adjusted, i.e. to As I've explained above, I'm not a fan of even more traits in the API surface :). We should make sure that the main recommended API usage for signing doesn't involve traits, but maybe goes via inherent functions on the params types (at least most of them, we can be economic here). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine with merging this one
In this case, because rcgen itself provides a single implementation of the trait, that seems like a clear way forward for users who want to stick with the simple path.
Sure, let's discuss in future PRs how to shape this API. |
This is an alternative direction to #326. From here, I think we can add a nice
Issuer
builder API.