WebCrypt compiles OpenSSL to WebAssembly, exposing a minimal JavaScript API and a demo UI that showcases cryptographic primitives directly in the browser.
- Automated build pipeline that:
- Installs and activates Emscripten SDK locally in
toolchains/ - Downloads and builds OpenSSL (configurable via
OPENSSL_VERSION) - Produces optimized
.min.js+.wasmartifacts and copies them intopublic/openssl/
- Installs and activates Emscripten SDK locally in
- TypeScript + Vite demo application with interactive UI for:
- SHA-256 hashing
- Random byte generation
- Base64 encoding / decoding
- Utility wrappers that expose a safe JavaScript interface over OpenSSL’s C APIs
- Node.js >= 20.12 (latest LTS recommended)
- Python 3 (required by OpenSSL build scripts)
- Build-essential toolchain (make, perl)
Install dependencies:
npm ciBuild the OpenSSL WebAssembly artifacts:
npm run build:opensslBuild the demo site:
npm run build:demoStart the development server:
npm run devThe demo will be available at http://localhost:4173.
├── native/ # C shim exposing curated OpenSSL surfaces
├── scripts/build-openssl.mjs
├── src/ # TypeScript demo UI
├── public/ # Static assets and generated wasm/js
└── dist/ # Build output (ignored by git)
npm run build:openssl– compile OpenSSL to WebAssembly and minified JSnpm run build:demo– produce a static production build of the demo via Vitenpm run dev– Vite dev server with HMRnpm run lint– Biome lint/format checksnpm run typecheck– TypeScript type checkingnpm run test:unit– Vitest unit suitenpm test– composite command running lint → typecheck → unit tests
- Set
OPENSSL_VERSIONenvironment variable to build a specific OpenSSL release. - Artifacts are written to both
dist/opensslandpublic/opensslso that Vite can serve them during development.
This repository contains the OpenSSL source code during the build step. OpenSSL is licensed under the Apache License 2.0.