A proof-of-concept repository showing how libsodium and the sodiumoxide bindings can be used in the browser with the wasm32-unknown-unknown target.
To test this out you'll need:
- A Linux machine
- The
docker
command - A nightly Rust compiler (
rustup update nightly
) - The wasm32 target (
rustup target add wasm32-unknown-unknown
) - The
wasm-bindgen
CLI command (cargo install wasm-bindgen-cli
) - Node.js with wasm support
And with all that in place you can execute the example with:
./build.sh
And you should see something like:
...
+ node run.js
10 randomly generated bytes are [132, 50, 0, 212, 16, 153, 236, 63, 8, 107]
sha256("Hello, World!") = dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f