rob thijssen e8bf9e20c7 fix(quantus-crypto): strip wasm-bindgen's fetch-based init from the shipped glue
The package could not be bundled. Every webpack consumer failed with:

  Module not found: Error: Can't resolve 'quantus_crypto_bg.wasm'
    in node_modules/@quantus/crypto/generated

wasm-bindgen's async `__wbg_init` contains

  module_or_path = new URL('quantus_crypto_bg.wasm', import.meta.url);

and webpack resolves `new URL(..., import.meta.url)` statically, at build time,
whether or not the branch can run. The file is not in the package — the wasm
ships base64'd in bytes.js, which is the entire point of this package — so the
build failed on a code path we never call.

node never sees it, which is why ten Rust tests, twelve consumer assertions and a
browser probe all passed while the package was unusable in a bundler. It took a
real extension build to surface, and that is the useful lesson: this package's
consumers bundle, and nothing in its own test suite does.

So the dead init is removed after bindgen runs. Shipping a second copy of the
wasm to satisfy a path we do not use would be the wide fix; deleting generated
code we never call is the narrow one.

The stripper asserts the shape it expects and throws if wasm-bindgen changes it,
rather than silently no-opping — a build that quietly stopped stripping would
ship the broken package again. It also re-checks that no reference to the .wasm
filename survives.

Published as 0.1.1.

Refs quantus/wasm#1, quantus/extension#2

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012uDUodEcRbBwNRi3UCmw8f
2026-09-15 11:53:18 +03:00
2025-08-13 13:59:40 -03:00
2025-01-02 21:26:31 +02:00
2020-10-23 11:14:40 +02:00
2019-03-17 13:12:14 +01:00
2022-01-13 10:05:36 +02:00
2019-03-17 13:12:14 +01:00
2021-06-08 17:04:07 +02:00
2026-03-13 01:32:10 +02:00
2025-01-02 21:26:31 +02:00
2025-12-09 15:27:27 +05:30
2019-03-15 13:00:05 +01:00
2025-12-09 10:03:06 +00:00
2026-03-13 01:32:10 +02:00
2022-08-16 15:04:17 +03:00
2019-03-17 13:12:14 +01:00
2022-12-08 08:21:37 +02:00
2026-03-13 01:32:10 +02:00

@polkadot/wasm

Various WASM wrappers around Rust crates

overview

It is split up into a number of internal packages, namely utilities -

  • wasm-crypto Various hashing functions, sr25519 & ed25519 crypto

These are split from the polkadot-js/util repo where it is heavily used as part of @polkadot/util-crypto. (There JS fallbacks are available for some interfaces, e.g. hashing, but for sr25519 WASM is the only interface). Since these don't undergo massive changes on a daily basis and has a build overhead (WASM compilation & optimisation), it is better managed as a seperate repo with a specific CI configuration.

development

Contributions are welcome!

To start off, this repo (along with others in the @polkadot family) uses yarn workspaces to organise the code. As such, after cloning, its dependencies should be installed via yarn, not via npm; the latter will result in broken dependencies.

Description
Fork of polkadot-js/wasm. Adds ML-DSA-65/87 and Poseidon2-over-Goldilocks to the @polkadot/wasm-crypto build, wrapping the chain's own qp-rusty-crystals-dilithium / qp-poseidon-core / qp-rusty-crystals-hdwallet crates so the browser and the runtime share one implementation.
Readme Apache-2.0 32 MiB
Languages
Rust 45.7%
JavaScript 25.1%
TypeScript 25%
Shell 4%
HTML 0.2%