Adds subresource integrity hashes to script and stylesheet imports from at index.html file at build time.
- Install wasmtime:
curl https://wasmtime.dev/install.sh -sSf | bash
- Download the
sri.wasm
compiled executing the code below at the project root:wget -c https://github.com/JADSN1894/sri/releases/download/<TAG_VERSION>/sri.wasm
- In your vite.config.js file:
- Execute:
wasmtime --dir=/ --dir=. <filename>.wasm <hash_algorithm> <airtifact_folder>
- Example:
wasmtime --dir=/ --dir=. ./sri.wasm Sha512 ./dist
Given the instability of the WASI API, utilizing Wasmtime ensures reliable execution of the compiled sri.wasm file.
Look for the issues: WASI support #441 and node:wasi fails during module resolution #23531
- WebAssembly System Interface (WASI)#
- WASI tutorial
- How to convert hexadecimal values to Base64 in Rust
- Deno wasi
- Synchronizy your type definitions between Rust and other languages for seamless FFI
- How works sha256
- Leveraging Rust to Bundle Node Native Modules and Wasm into an Isomorphic NPM Package
- WebAssembly System Interface (WASI)
- Getting started with NodeJS and the WebAssembly System Interface