* Bump UI, HDKD keyring (new substrate crypto) * Bump ui/* versions * Pull in latest util-crypto, bp39 fix * Bump common * Small enhancements, cleanups (testing WIP) * Bump * Update after merge * Bumps, fix transfer calculation (value may be non-existent) * Bumpo dependencies * Label extrinsic hash * Signature updates * Update deps * Adjust status display * Close status items on click * Update withRouter duplication * API bump, (some) creation fixes * Move bip39 out of the worker (fast enough now via WASM) * Update after master merge * Cleanup deps (re-write yarn.lock)
27 lines
776 B
TypeScript
27 lines
776 B
TypeScript
// Copyright 2017-2019 @polkadot/app-accounts authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
|
|
import { cryptoWaitReady, mnemonicGenerate, mnemonicToMiniSecret, naclKeypairFromSeed, schnorrkelKeypairFromSeed } from '@polkadot/util-crypto';
|
|
|
|
const ctx: Worker = self as any;
|
|
|
|
cryptoWaitReady().catch(() => {
|
|
// ignore
|
|
});
|
|
|
|
ctx.onmessage = async ({ data: { pairType } }) => {
|
|
await cryptoWaitReady();
|
|
|
|
const seed = mnemonicGenerate();
|
|
const miniSecret = mnemonicToMiniSecret(seed);
|
|
const { publicKey } = pairType === 'sr25519'
|
|
? schnorrkelKeypairFromSeed(miniSecret)
|
|
: naclKeypairFromSeed(miniSecret);
|
|
|
|
ctx.postMessage({
|
|
publicKey,
|
|
seed
|
|
});
|
|
};
|