Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.72 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.72 KB

vault-wasm

vault-wasm contains the WebAssembly bindings for the Vault core engine.

Dependencies

Install wasm-pack:

cargo install --version 0.12.1 wasm-pack

vault-wasm-web

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

vault-wasm-nodejs

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

Use of unsafe

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.