3.1.0 • Published 3 years ago
openssl-wasm v3.1.0
openssl-wasm
What is this?
This repository holds the source files and generated WebAssembly (WASM) output for OpenSSL compiled to WASM.
Versioning
The versions here are linked to OpenSSL versions, so if you require('openssl-wasm') and get OpenSSL 3.1.0, but you want OpenSSL 1.1.1 then you should install that with npm install openssl-wasm@1.1.1
Getting Started
The following assumes that you are working in a bash terminal with docker installed and available.
- Build the
openssl-wasmdocker image- Run
./src/build-image.sh - The image expects a volume to be mounted at
/WASM
- Run
- Build a specific version of OpenSSL
- Run
docker run openssl-wasm OpenSSL_1_1_1-stableif you want to buildOpenSSL_1_1_1-stable - You can use any tag or branch from the OpenSSL GitHub repo
- Run
- Build all OpenSSL tags and branches
- Run
./src/build-all-tags.sh - It takes a while
- Run
How does it work?
tldr; it uses empscripten to build the specified OpenSSL tag or branch in a container, and the WASM output is written to a mounted volume (a local folder).
- The
Dockerfile- Installs dependencies
- Installs
emscriptenSDK (emsdk) - Clones the OpenSSL repo into the image
- Copies the build script (
./src/docker/emscripten.sh) on build
- The
openssl-wasmimage- Will
git checkoutthe given a tag or branch name - Configure
emsdkand build tooling - Builds OpenSSL using
emmake make - Copies the output to the mounted volume/folder
- Will
- The
*.wasmoutput- Should be copied to a local folder
- Should have an
openssl.jsfile (Module) to load the WebAssembly - Should have an
openssl.wasmfile which is the WebAssembly version of OpenSSL