vault-wasm
contains the WebAssembly bindings for the Vault core engine.
Install wasm-pack
:
cargo install --version 0.12.1 wasm-pack
Build the WebAssembly package using wasm-pack
(development build):
wasm-pack build --target web --out-dir ../vault-web/src/vault-wasm --out-name vault-wasm --dev
Build the WebAssembly package using wasm-pack
(release build):
wasm-pack build --target web --out-dir ../vault-web/src/vault-wasm --out-name vault-wasm
Watch for changes and build (you need to have cargo watch installed):
cargo watch -w . -i .gitignore -w ../vault-core -i ../vault-core/.gitignore -s "wasm-pack build --target web --out-dir ../vault-web/src/vault-wasm --out-name vault-wasm --dev"
Watch for changes and run cargo check
:
cargo watch -w . -i .gitignore -w ../vault-core -i ../vault-core/.gitignore
Build the WebAssembly package using wasm-pack
(development build):
wasm-pack build --target nodejs --out-dir ../vault-web-tests/vault-wasm-nodejs --out-name vault-wasm --dev
./fix-helpers-nodejs.sh ../vault-web-tests/vault-wasm-nodejs
Build the WebAssembly package using wasm-pack
(release build):
wasm-pack build --target nodejs --out-dir ../vault-web-tests/vault-wasm-nodejs --out-name vault-wasm
./fix-helpers-nodejs.sh ../vault-web-tests/vault-wasm-nodejs
The vault-core
is designed to facilitate multi-threading. In the context of
vault-wasm
, unsafe
is used to make WASM bindings Send + Sync
for calling
vault-core
. This approach is considered safe since WASM execution in browsers
is inherently single-threaded.