mirror of
https://github.com/pezkuwichain/pezkuwi-wasm.git
synced 2026-10-27 22:09:50 +00:00
7.5.15-7.5.18 shipped a wasm built from a separate sr25519-only module
(4 exports) and replaced every other function in bundle.ts with a stub
that throws "not yet implemented": ed25519 pair/sign/verify, sr25519
agree and hard/soft derivation, VRF, and all of secp256k1. Because the
wasm still initialised, isReady() was true and @pezkuwi/util-crypto
called those stubs instead of falling back to JS, so ed25519 and
ethereum accounts and any // derivation failed at runtime wherever the
package is used. bip39Generate threw as well, and bip39ToSeed hashed with
SHA-256 where BIP39 specifies SHA-512.
The Rust in packages/wasm-crypto/src/rs already implemented all of it,
with sr25519 under the "bizinikiwi" context. This builds that crate and
binds it again:
- bundle.ts: the withWasm bindings for every ext_* export, as in
b61206c; getSigningContext() kept, returning "bizinikiwi".
- wasm-bridge: wasm-bindgen 0.2.90 passes an alignment to
__wbindgen_malloc/__wbindgen_free (without it Rust aborts with
`unreachable`); __wbindgen_memory returns a heap index; the two-argument
getRandomValues import takes the crypto object and a Uint8Array by heap
index, not a pointer and length.
- build-wasm.sh: source rust-version.sh relative to the script; strip the
`import * as wbg` line newer wasm2js emits and call asmFunc({ wbg }),
which is the shape its output expects.
- pack-wasm-base.mjs: also write build/bytes.js. The package exports
./bytes from there for ESM, and it was still the old sr25519-only wasm.
The committed src copies are now empty placeholders, so a build that
skips the wasm step fails instead of shipping a stale binary.
- Tests: the sr25519 known-signature vectors were substrate-context
vectors; they are replaced by vectors signed by 7.5.18, plus a test that
the same seed yields the same public key. A rename had changed the
substrate-bip39 vector's password to "Bizinikiwi"; it is "Substrate".
Compatibility with 7.5.18, measured in separate processes:
mnemonic -> mini secret -> public key is identical for every phrase with
an empty or ASCII password (12/12). It differs when the BIP39 password has
characters NFKD changes: 7.5.18 normalised it, while the Rust crate and
util-crypto's JS path do not, so this returns to the canonical result.
Rust 43/43, JS 55/55, wasm and asm.js runners pass. With this build in
place, pezkuwi-extension's suite goes from 19 failing to 3 (the 3 left
are unrelated sorting tests).
All wasm packages move to 7.5.19 and pin each other at 7.5.19.
125 lines
3.3 KiB
JSON
125 lines
3.3 KiB
JSON
{
|
|
"author": "PezkuwiChain <dev@pezkuwichain.io>",
|
|
"bugs": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-wasm/issues",
|
|
"description": "Wasm content for wasm-crypto",
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"homepage": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-wasm/tree/master/packages/wasm-crypto-wasm#readme",
|
|
"license": "Apache-2.0",
|
|
"name": "@pezkuwi/wasm-crypto-wasm",
|
|
"repository": {
|
|
"directory": "packages/wasm-crypto-wasm",
|
|
"type": "git",
|
|
"url": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-wasm.git"
|
|
},
|
|
"sideEffects": [
|
|
"./build/packageDetect.js",
|
|
"./build/cjs/packageDetect.js"
|
|
],
|
|
"type": "module",
|
|
"types": "./build/index.d.ts",
|
|
"version": "7.5.19",
|
|
"main": "./build/cjs/index.js",
|
|
"module": "./build/index.js",
|
|
"exports": {
|
|
".": {
|
|
"module": {
|
|
"types": "./build/index.d.ts",
|
|
"default": "./build/index.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/index.d.ts",
|
|
"default": "./build/cjs/index.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/index.d.ts",
|
|
"default": "./build/index.js"
|
|
}
|
|
},
|
|
"./bundle": {
|
|
"module": {
|
|
"types": "./build/bundle.d.ts",
|
|
"default": "./build/bundle.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/bundle.d.ts",
|
|
"default": "./build/cjs/bundle.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/bundle.d.ts",
|
|
"default": "./build/bundle.js"
|
|
}
|
|
},
|
|
"./bytes": {
|
|
"module": {
|
|
"types": "./build/bytes.d.ts",
|
|
"default": "./build/bytes.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/bytes.d.ts",
|
|
"default": "./build/cjs/bytes.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/bytes.d.ts",
|
|
"default": "./build/bytes.js"
|
|
}
|
|
},
|
|
"./cjs/*": "./build/cjs/*.js",
|
|
"./cjs/package.json": "./build/cjs/package.json",
|
|
"./package.json": "./package.json",
|
|
"./packageDetect": {
|
|
"module": {
|
|
"types": "./build/packageDetect.d.ts",
|
|
"default": "./build/packageDetect.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/packageDetect.d.ts",
|
|
"default": "./build/cjs/packageDetect.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/packageDetect.d.ts",
|
|
"default": "./build/packageDetect.js"
|
|
}
|
|
},
|
|
"./packageInfo": {
|
|
"module": {
|
|
"types": "./build/packageInfo.d.ts",
|
|
"default": "./build/packageInfo.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/packageInfo.d.ts",
|
|
"default": "./build/cjs/packageInfo.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/packageInfo.d.ts",
|
|
"default": "./build/packageInfo.js"
|
|
}
|
|
},
|
|
"./packageInfo.js": {
|
|
"module": {
|
|
"types": "./build/packageInfo.d.ts",
|
|
"default": "./build/packageInfo.js"
|
|
},
|
|
"require": {
|
|
"types": "./build/cjs/packageInfo.d.ts",
|
|
"default": "./build/cjs/packageInfo.js"
|
|
},
|
|
"default": {
|
|
"types": "./build/packageInfo.d.ts",
|
|
"default": "./build/packageInfo.js"
|
|
}
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"@pezkuwi/wasm-util": "7.5.19",
|
|
"tslib": "^2.7.0"
|
|
},
|
|
"devDependencies": {
|
|
"@pezkuwi/util": "^14.0.1"
|
|
},
|
|
"peerDependencies": {
|
|
"@pezkuwi/util": "*"
|
|
}
|
|
}
|