Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

JavaScript and WebAssembly

Build the Wasm module and run the Node.js integration tests from the repository root.

rustup target add wasm32-unknown-unknown
cargo build --locked -p quantaegis-wasm --target wasm32-unknown-unknown --release
node --test wasm/test/quantaegis.test.mjs

In Node.js, read the compiled module with readFile and pass the bytes to initQuantAegisWasm, exported by wasm/quantaegis.mjs. In a browser, pass the ArrayBuffer returned by the fetched Wasm response. Key generation, KEM encapsulation and randomized signing require globalThis.crypto.getRandomValues.

On the initialized instance, qa.XWing.keygen() returns { ek, dk }. Calling qa.XWing.encaps(ek) returns { ct, sharedSecret }. The recipient can recover the shared secret with qa.XWing.decaps(dk, ct). Keys and ciphertexts are Uint8Array values. A signature mismatch throws an exception. Native failures expose a numeric code via QuantAegisWasmError.code. TypeScript declarations

This release implements X-Wing draft-11. ML-KEM and X-Wing decapsulation return 32 bytes even for an invalid capsule of the correct length. A returned secret alone cannot authenticate a message. Keep secret keys, seeds and shared secrets in Uint8Array buffers and clear each owned copy with .fill(0) after use. Wiping Wasm memory cannot clear copies on the JavaScript heap.