wasm32 is especially difficult to deal with w.r.t. timing side channel protections, as this is controlled by the wasm32 compiler and runtime.
wasm32-wasi is supported without any feature flags.
wasm32-unknown-unknown is supported if ring's wasm32_unknown_unknown_js feature is enabled, in which case Crypto.getRandomValues() will be used. We are open to accepting PRs to add to similar feature flags for other wasm32-unknown-unknown environments.
Libraries that want to work similarly should consider providing a similar feature flag to the library that triggers the wasm32_unknown_unknown_js feature, like this:
We should document:
wasm32_unknown_unknown_js
feature is enabled, in which caseCrypto.getRandomValues()
will be used. We are open to accepting PRs to add to similar feature flags for other wasm32-unknown-unknown environments.Libraries that want to work similarly should consider providing a similar feature flag to the library that triggers the
wasm32_unknown_unknown_js
feature, like this:Alternatively, the application can always ask for the feature to be enabled itself, even if it doesn't otherwise directly use ring: