-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conventions for RNG APIs with getrandom
feature
#19
Comments
It's mildly off topic here, but |
We also should decide whether we want to expose potential errors in our API. If yes, then we also should introduce something like
It should be fine in implementation crates, but I don't think we should do it in the trait crates. We should be careful with accidentally making it impossible to disable. |
@newpavlov is that going to change upstream in The idea proposed in this issue is to keep the method parameterized on If |
@tarcieri
Arguably, embedded users should use the custom backend capability in As I see it, we probably should support generic RNGs, but mostly for performance reasons. User-space RNGs (such as |
Oh interesting re: So I guess we should switch to fallible RNGs when making breaking changes.
|
Most crates are now using In the next breaking releases we can migrate to the fallible API. I guess there's still an open question of conventions for an explicit RNG versus implicit |
In many places we document how to import and pass
OsRng
, often providing agetrandom
feature that re-exportsrand_core
.Instead of that, we can add
#[cfg(feature = "getrandom")]
-gated functions which passOsRng
for you.For example:
If we go this route, some questions:
CryptoRng(Core)
-parameterized methods be? We use bothgenerate
andrandom
.getrandom
-gated wrapper which passesOsRng
for you? Should we make that shorter to be more convenient?getrandom
by default for even more convenience?The text was updated successfully, but these errors were encountered: