@polkadot/wasm-bridge
A re-usable bridge between JS & WASM interfaces. It is used internally by @polkadot/wasm-crypto
.
A bridge layer between JS and Wasm
A re-usable bridge between JS & WASM interfaces. It is used internally by @polkadot/wasm-crypto
.
Changes:
Changes:
Changes:
?.
as per (latest) linting rulesChanges:
cjs/bytes.js
generation to follow export.<var> = ...
formmodule
to package.json
export map (ESM-only)Changes:
readonly
specifiers to private class fields where applicable__internal__
class fieldsChanges:
wasm-util
as dependency where x-randomvalues
is a peerChanges:
.js
imports in source files (TS moduleResolution)Changes:
@polkadot/dev
(w/ tsc jsx detection output changes)Changes:
node:test
runner (ESM & CJS variants)Changes:
/*#__PURE__*/
annotations for specific export const something = someFunction(...)
Changes:
import_map.in.json
for Deno testsChanges:
Changes:
Changes:
peerDependencies
to wasm-crypto
(bridge
requirement)WebAssembly.{Memory, ModuleImports}
usage to cater for non-dom TSChanges:
Changes:
Changes:
Changes:
Changes:
wasm-{bridge, util}
packages for internal re-useexport
map and main
field in package.json
does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.Changes:
cjs/**
rootChanges:
libsecp256k1
to secp256k1
(this aligns with the Substrate use)wasm-crypto/init*
to also export initWasm(): Promise<void>
(optional manual init)wasm-crypto/initNone
with no defined Wasm or Asm interfacesimport '@polkadot/wasm-crypto/initOnlyAsm'
at your project top-level to ensure that asm.js is initialized. (Or alternatively import '@polkadot/wasm-crypto/initWasmAsm'
to future-proof when WASM does become available)data
and empty
of the internal wasm-crypto-{wasm, asmjs}
packages in their bundlers, swap to one of the @polkadot/wasm-crypto/init*
top-level imports to set the type of interfaces you would prefer. A full writeup of the rationale and other options can be found in the FAQChanges:
@polkadot/wasm-crypto/init{OnlyAsm, OnlyWasm, WasmAsm}
to allow specific interface typeswasm-bindgen
, binaryen
& wabt
packages in buildChanges:
import.meta.url
is undefinedChanges:
secp256k1{Compress, Expand, Recover, Sign}
functions.unwrap()
(match everywhere)Changes:
hmacSha256
& hmacSha512
functionsContributed:
Changes:
keccak512
functionsha256
functionContributed:
Changes:
Changes:
@polkadot/dev
to allow for bundles with new-formatChanges:
engines
field to package.json
Changes:
Important In the 4.0 version the default package type has been changed to ESM modules by default. This should not affect usage, however since the output formats changed, a new major version is required.
Changes:
Changes:
Changes:
.js
source, not .json
Changes:
module
field in package.json
Contributed:
ext_vrf_{sign, verify}
methods (Thanks to https://github.com/stiiifff)Changes:
.editorconfig
for Rust sourcesvrf_{sign,verify}_extra
, secp256k1
with tests)Changes:
Important This assumes @polkadot/util
5+ peerDependencies
Important While this package contains no external interface changes, it doe now compile and ship both cjs and esm modules. This means that modern bundlers will have more information for tree-shaking available. Additionally when using Node with .mjs
extensions, the esm version imports will be used on recent Node versions. Adding an export map, as here, may have some impacts so a major semver bump is advised. There may be (small) dragons hiding in the dark corners...
Changes:
@polkadot/wasm-crypto-{wasm,asmjs}
packagesChanges:
crypto
dependency, this is now applied by @polkadot/x-randomvalues
rs/
subfolderChanges:
bip39ToSeed
dropped in the previous version (ETH-compatible pairs)Changes:
scrypt
function for KDF generationbip39ToSeed
, we only use the bip39ToMiniSecret
variant in SubstrateChanges:
verify_simple_preaudit_deprecated
for signature verification, instead it now uses verify_simple
. Only schnorrkel 0.8+ signatures will now pass verification. This is a follow-up of the 0.1 signing support that was dropped in a previous version.Changes:
Changes:
Changes:
Changes:
Changes:
"react-native"
entry in package.json
. Ensure that you run the build step with the NODE_OPTIONS=--max_old_space_size=8192
flags, since the asm.js bundle is large. (For RN the full command would therefore be NODE_OPTIONS=--max_old_space_size=8192 npm start
)Changes:
@polkadot/wasm-schnorrkel
& @polkadot/wasm-dalek-ed25519
source (all combined in @polkadot/wasm-crypto
, was kept for historical purposes)hex-literal
for recent versions of the compiler (used in tests only)Changes:
Changes:
Changes:
Changes:
@polkadot/wasm-crypto
as well (smaller final size)wasm-dalek-ed25519
& wasm-schnorrkel
__wasm_malloc of null
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes: