Files
wasm/packages/wasm-crypto
Jaco Greeff 9f08e7832f Bump schnorrkel to 0.8 (#29)
* Bump schnorrkel to 0.8

* Remove unneeded return refactor (stick to issues at-hand)

* Mid-point step, use rev, verify signatures

* Update to 0.8.2

* Flatten for easier inspection

* 0.8.3 rev that passes the tests

* Updates for 0.8.3 memory allocation

* Test for Rust keypair imports

* Rust ed25519 compat

* 0.8.4

* sr25519 0.8.5, bump deps

* tiny-keccak config

* Update keccack hashing

* Update hashing
2020-01-13 16:26:04 +01:00
..
2020-01-13 16:26:04 +01:00
2020-01-06 13:44:06 +01:00
2020-01-13 16:26:04 +01:00
2020-01-13 16:26:04 +01:00
2020-01-13 16:26:04 +01:00
2019-07-20 12:37:38 +02:00

@polkadot/wasm-crypto

Wrapper around crypto hashing functions

Usage

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

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

Use it -

const { u8aToHex } = require('@polkadot/util');
const { bio39Generate, bip39ToSeed, waitReady } = require('@polkadot/wasm-crypto');

async function main () {
  // 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));
}