-
Notifications
You must be signed in to change notification settings - Fork 718
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
Separate getrandom features for wasm32-unknown-unknown target #2218
base: main
Are you sure you want to change the base?
Separate getrandom features for wasm32-unknown-unknown target #2218
Conversation
…nknown_js, and wasm32_unknown_unknown_custom_or_js.
I have researched this further. With the WASI 0.2 component model, there's not much reason for wasm32-unknown-unknown to exist any longer. In any environment that currently uses wasm32-unknown-unknown, a minimal WASI 0.2 environment that implements just the Consequently, I think we shouldn't bother trying to do more than we're currently doing. |
Thanks for researching into this! However, I have to point out that WASI is not the only game in town, and there are plenty use cases where randomness is supplied through other means, or no randomness is required at all (e.g. when ring is only used for verification purpose). Anyway, the problem with cargo features is that once a feature is brought in, there is no way to avoid it. And PS: I work on Internet Computer that has deployed close to a million wasm programs/services onto the internet. Not an insignificant use case, I'd say. And these wasm programs do not run with WASI. Besides, if they need randomness, it has to be supplied asynchronously, so a synchronous interface (like the one in WASI) does not cut it. I hope I've made a valid case here. Thank you for the consideration! |
If you look at the design of |
ring also expects a synchronous randomness API with its current design. I'm not sure how we'd support an async API. |
Not sure if I understood all the nuances of how getrandom works in wasm32-unknown-unknown, but isn't the custom feature delegating the randomness provision to the user, so that libraries using getrandom does not have to worry about them? The documentation of getrandom also says the following about the
|
Instead of just having one
wasm32_unknown_unknown_js
feature that imposesgetrandom/js
upon ring's users, two additional features are added to provide more flexibility.wasm32_unknown_unknown_custom_or_js
implementsSecureRandom
forSystemRandom
, but does not make a choice betweengetrandom/js
orgetrandom/custom
. It instead delegates the choice to the library's user.wasm32_unknown_unknown_js
enables bothwasm32_unknown_unknown_custom_or_js
andgetrandom/js
.wasm32_unknown_unknown_custom
enables bothwasm32_unknown_unknown_custom_or_js
andgetrandom/custom
.This change is only relevant for the
wasm32-unknown-unknown
target.