-
Notifications
You must be signed in to change notification settings - Fork 78
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
feat: Add wasm support #1316
feat: Add wasm support #1316
Conversation
There's one test failing. After debugging I found out that in the json file: What should I do in this case? |
4a042d4
to
42107dc
Compare
Closing because this is now replaced by #1483. |
This adds wasm support to OpenMls. I've added new workflow jobs to run tests on wasm target. They'll be tested in chrome and firefox.
Some library changes were needed in order to make this work:
fluvio-wasm-timer
was added in order to provide thestd::time
structs. This is basically a wrapper that will use eitherstd::time
or theweb-sys
crate.ed25519-dalek
was upgraded because it seems the underlyingrand-core
is not compatible with wasmrayon
andcriterion
will be available just for non wasm targets.About
rayon
, at the moment for wasm it will use a regular iterator instead of the parallel. There's the option to add wasm-bindgen-rayon. This will provide parallel iterators for wasm but we could re-export the functioninit_thread_pool
to OpenMls consumers as it needs to be called before using it (only in wasm targets) or we would have to document that they have to add this as dependency and call it. If you're willing to have it I could add it behind a feature so consumers can choose what fits best for them.What still needs to be done is add the macro
#[wasm_bindgen_test]
to all tests and the call in each test module towasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser)
. Tests that don't have this will be ignored. At the moment I've added in just one so you can see what kinds of changes need to be done in the tests to run on wasm. If you're okay with it I could adapt and make sure all tests run on wasm. (I can do it in a separate PR if you prefer)I've noticed that the
SingatureKeyPair
struct needs a random generator, shouldn't it be usingOpenMlsCrypto
instead of re-implementing it?