fnichol/names

Doesn't work on wasm32-unknown-unknown target

saikatdas0790 opened this issue · 2 comments

This is what I'm seeing

image

I understand that this package has internal dependencies that rely on getrandom which doesn't support wasm32-unknown-unknown as documented here

I am going to be running this on a blockchain that only supports the wasm32-unknown-unknown target. On this platform, they have APIs that provide their own source of randomness.

I was wondering if you are open to adding to the API that lets the caller pass their own source of randomness and that is then used to seed and generate the names. On the platform that I'll be deploying to, the random value looks like this

Thoughts?

https://docs.rs/getrandom/latest/getrandom/#webassembly-support:

To enable the js Cargo feature, add the following to the dependencies section in your Cargo.toml file:

[dependencies]
getrandom = { version = "0.2", features = ["js"] }

This can be done even if getrandom is not a direct dependency. Cargo allows crates to enable features for indirect dependencies.

Could you not just add that to your Cargo.toml?

I did not try this. For now, I ended up doing this functionality client side. Will try next time I need this