WebAssembly build of the OpenSSL library providing cryptographic functionality for CoWasm programs
npx @tessl/cli install tessl/npm-cowasm--openssl@1.0.0@cowasm/openssl provides a WebAssembly build of the OpenSSL 3.0.7 library for use within the CoWasm ecosystem. It serves as a foundational cryptographic library dependency, offering pre-compiled OpenSSL binaries optimized for WebAssembly execution.
npm install @cowasm/opensslconst { path } = require("@cowasm/openssl");For ES modules:
import { path } from "@cowasm/openssl";const { path } = require("@cowasm/openssl");
const { join } = require("path");
// Get the path to OpenSSL WASM binaries
console.log("OpenSSL WASM binaries located at:", path);
// Access specific OpenSSL components
const opensslBinary = join(path, "bin", "openssl");
const libsslPath = join(path, "lib");
const headersPath = join(path, "include");@cowasm/openssl is designed as a WebAssembly binary distribution package:
Provides the file system path to the compiled OpenSSL WebAssembly binaries and libraries.
/**
* File system path to the directory containing OpenSSL WASM binaries
* Points to the dist/wasm directory within the package
*/
const path: string;Usage Example:
const { path } = require("@cowasm/openssl");
const fs = require("fs");
// List available OpenSSL components
console.log("OpenSSL WASM directory contents:");
console.log(fs.readdirSync(path));
// Typical output might include:
// ['bin', 'lib', 'include', 'share']The compiled OpenSSL WebAssembly distribution includes:
bin/openssl - OpenSSL command-line tool compiled for WebAssemblylib/ - OpenSSL libraries (libssl, libcrypto) in WebAssembly formatinclude/ - OpenSSL header files for developmentshare/ - Additional OpenSSL resources and documentationThe package applies WebAssembly-specific patches and compilation flags:
00-af-unix.patch - Modifies AF_UNIX socket support for WebAssembly compatibility01-cleanup-hack.patch - Cleanup modifications for WebAssembly environmentconst { path } = require("@cowasm/openssl");
// CPython ssl module can locate OpenSSL libraries at this path
process.env.OPENSSL_ROOT_DIR = path;const { path } = require("@cowasm/openssl");
const { spawn } = require("child_process");
// Execute OpenSSL command-line tool in WebAssembly environment
const opensslCmd = require("path").join(path, "bin", "openssl");
// Note: Actual execution would require CoWasm runtime environmentconst { path } = require("@cowasm/openssl");
const { join } = require("path");
// Locate specific OpenSSL libraries
const libssl = join(path, "lib", "libssl.a");
const libcrypto = join(path, "lib", "libcrypto.a");
const headers = join(path, "include", "openssl");The package exports are synchronous and do not throw exceptions under normal operation. The path export will always return a valid string pointing to the WASM distribution directory within the package.
/**
* The main export object containing the path to OpenSSL WASM binaries
*/
interface OpenSSLExports {
/** File system path to the OpenSSL WASM distribution directory */
path: string;
}