Files
pezkuwi-wasm/packages/wasm-crypto
Satoshi Qazi Muhammed d0520842dc Move wasm-crypto off the crate versions with advisories
curve25519-dalek 2/3 -> 4.1.3 (timing variability in Scalar52::sub, on
every signature), ed25519-dalek 1 -> 2, schnorrkel 0.9 -> 0.11, merlin
2 -> 3, secp256k1 0.21 -> 0.29, tiny-bip39 0.7 -> 1.0 (drops failure),
keccak 0.1.6, rand 0.8. wee_alloc is unmaintained and is no longer the
global allocator. OSV: 9 crates with advisories before, 0 after.

secp256k1 is built with lowmemory: newer libsecp256k1 embeds about 1 MB
of precomputed tables, which would have quadrupled the wasm. The
signatures are the same; recovery uses a smaller window.

getrandom 0.2 is used with a custom backend that calls one fixed
import, wbg.ext_fill_random, which the bridge fills from
@pezkuwi/x-randomvalues. The getrandom "js" backend would have needed a
dozen new hashed wasm-bindgen imports in the bridge; the wasm now has
one import instead of 18.

The recorded known answers still hold, and signatures made by either
build verify in the other.
2026-10-12 06:17:29 +04:00
..
2026-10-07 09:36:56 +04:00

@pezkuwi/wasm-crypto

Wrapper around crypto hashing functions

Usage

Install the package (also requires @pezkuwi/util for TextEncoder polyfills - not included here as a dependency to keep the tree lean)

yarn add @pezkuwi/wasm-crypto @pezkuwi/util

Use it -

import { u8aToHex } from '@pezkuwi/util';
import { bip39Generate, bip39ToSeed, waitReady } from '@pezkuwi/wasm-crypto';

// first wait until the WASM has been loaded (async init)
await waitReady();

// generate phrase
const phrase = bip39Generate(12);

// get ed25519 seed from phrase
const seed = bip39ToSeed(phrase, '');

// display
console.log('phrase:', phrase);
console.log('seed:', u8aToHex(seed));