vault-wasm contains the WebAssembly bindings for the Vault core engine.
Install wasm-pack:
cargo install --version 0.13.1 wasm-packBuild the WebAssembly package using wasm-pack (development build):
wasm-pack build --target web --out-dir ../vault-web/src/vault-wasm --out-name vault-wasm --devBuild the WebAssembly package using wasm-pack (release build):
wasm-pack build --target web --out-dir ../vault-web/src/vault-wasm --out-name vault-wasmWatch 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/.gitignoreBuild 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-nodejsBuild 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-nodejsThe 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.