mirror of
https://github.com/pezkuwichain/pezkuwi-wasm.git
synced 2026-10-27 13:59:51 +00:00
85803931d6c25d3ef0e8d3e364129e86832e40af
The six wasm packages carried the build's rewritten package.json as their source: exports, browser and react-native pointing at ./build/cjs/*, main at ./build/cjs/index.js. The build rewrote them again, so the published 7.5.17 and 7.5.19 had exports naming files that are not in the package (init's "." resolved to ./build/cjs/wasm.js) and './package.json' spread into an object of characters. This is the January 2026 ./cjs/cjs/ fault in another form; its cause was committing built manifests, not the build script. main, module, types, exports, browser, react-native and sideEffects are back to the form of the upstream sources they were renamed from; the build generates the rest. scure-sr25519 has no upstream counterpart and a consistent hand-written manifest, so it is left as it is. CI now checks every build/package.json: each entry point must name a file that is there, with no ./build/ or ./cjs/cjs/ path, no numeric keys in exports and no workspace/portal ranges. Red on the 7.5.19 build, green on this one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pezkuwi/wasm-crypto
WASM cryptographic primitives for PezkuwiChain.
Overview
This package provides WebAssembly-based cryptographic functions used by PezkuwiChain applications, including:
- SR25519 - Schnorr signatures with Ristretto point compression (bizinikiwi signing context)
- ED25519 - Edwards-curve Digital Signature Algorithm
- BIP39 - Mnemonic code for generating deterministic keys
- Hashing - Blake2b, SHA256, SHA512, Keccak, XXHash, Scrypt, PBKDF2
Installation
npm install @pezkuwi/wasm-crypto
# or
yarn add @pezkuwi/wasm-crypto
Usage
import { waitReady, sr25519KeypairFromSeed, sr25519Sign } from '@pezkuwi/wasm-crypto';
// Initialize WASM
await waitReady();
// Generate keypair from seed
const seed = new Uint8Array(32); // your seed here
const keypair = sr25519KeypairFromSeed(seed);
// Sign a message
const publicKey = keypair.slice(64);
const secretKey = keypair.slice(0, 64);
const message = new TextEncoder().encode('Hello PezkuwiChain!');
const signature = sr25519Sign(publicKey, secretKey, message);
Packages
| Package | Description |
|---|---|
@pezkuwi/wasm-crypto |
Main package with all crypto functions |
@pezkuwi/wasm-crypto-wasm |
Compiled WASM binary |
@pezkuwi/wasm-crypto-asmjs |
ASM.js fallback for older browsers |
@pezkuwi/wasm-crypto-init |
Initialization helpers |
@pezkuwi/wasm-bridge |
WASM bridge utilities |
@pezkuwi/wasm-util |
Utility functions |
Building from Source
# Install dependencies
yarn install
# Build WASM and JavaScript
yarn build
# Run tests
yarn test
Prerequisites
- Node.js 18+
- Rust toolchain (for WASM compilation)
- wasm-pack
Signing Context
This package uses bizinikiwi as the SR25519 signing context, which is unique to PezkuwiChain. This ensures signature incompatibility with other networks for security.
License
Apache-2.0
Languages
TypeScript
38.5%
JavaScript
34%
Rust
22.4%
Shell
3.4%
Python
1.7%