Git Product home page Git Product logo

Comments (5)

burdges avatar burdges commented on June 2, 2024

I donno much about the range of wasm targets that exist, or what normally happens, but wasm was meant to be quite deterministic, and ours bans any form of real randomness or secrets. I'd assume that no_std wasm has basically nothing unless you'd some additional host interface that supplies it, but not really sure.

from getrandom.

josephlr avatar josephlr commented on June 2, 2024

This will get clarified w/ the 0.2 release (see #135). But the basic idea is:

  • getrandom works perfectly fine on wasm32-unknown-emscripten and wasm32-wasi
  • getrandom does not automatically work on wasm32-unknown-unknown
    • Enabling the getrandom/js cargo feature will make this target work
    • Enabling this feature essentially says "I assume I'm running in an enviornment w/ JavaScript". This includes:
  • There are no other Rust wasm32 targets that I am aware of. If new ones are added, they would not automatically work, and a pull request to getrandom would be needed.

Comment either here or in the doc bug if the above seems unclear or incorrect.

from getrandom.

burdges avatar burdges commented on June 2, 2024

I believe the rust target is wasm32-unknown-unknown. If I read lib.rs correctly, wasm32-unknown-unknown without wasm32_bindgen or wasm32_stdweb compiles to dummy.rs, which always errors. This is correct behavior for "perfectly" deterministic wasm targets. I think this can be closed.

from getrandom.

josephlr avatar josephlr commented on June 2, 2024

Sounds good.

If I read lib.rs correctly, wasm32-unknown-unknown without wasm32_bindgen or wasm32_stdweb compiles to dummy.rs, which always errors. This is correct behavior for "perfectly" deterministic wasm targets. I think this can be closed.

This is correct for v0.1. For v0.2 we are changing things so that getrandom will not compile on unsupported targets (i.e. wasm32-unknown-unknown without JavaScript). See lib.rs on the 0.2 branch.

from getrandom.

burdges avatar burdges commented on June 2, 2024

I see, getrandom is already an optional dependency of rand_core and rand though, so this sounds good too.

from getrandom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.