mirror of
https://github.com/pezkuwichain/pezkuwi-wasm.git
synced 2026-10-28 14:29:51 +00:00
Lint never ran here: the build step stopped first on @pezkuwi/dev 0.85.7. With it running: - .prettierrc.cjs loaded @polkadot/dev; it is @pezkuwi/dev - license headers on .prettierrc.cjs and scripts/pack-wasm-base.mjs - packages/scure-sr25519/lib holds compiled files only; it is ignored - the wasm-crypto test entries take upstream's form: one @ts-ignore, for the build output that may not exist, with the reason; test globals by reference - three ad-hoc scripts from the 7.5.17 release, referenced nowhere, removed Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@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));