Files
common/packages/util-crypto/src/index.ts
T
Jaco Greeff 6907add8ff Move address helpers to util-crypto (#416)
* Move address helpers to util

* Move address helpers to @polkadot/util-crypto
2019-06-12 15:01:54 +02:00

36 lines
911 B
TypeScript

// Copyright 2017-2019 @polkadot/util-crypto 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 './polyfill';
import wasmCrypto from '@polkadot/wasm-crypto';
export * from './address';
export * from './blake2';
export * from './keccak';
export * from './key';
export * from './mnemonic';
export * from './nacl';
export * from './random';
export * from './schnorrkel';
export * from './secp256k1';
export * from './sha512';
export * from './xxhash';
export function cryptoWaitReady (): Promise<boolean> {
return wasmCrypto
.waitReady()
.then(() => true)
.catch((error) => {
console.error('Unable to initialize @polkadot/util-crypto', error);
return false;
});
}
// start init process immediately
cryptoWaitReady().catch(() => {
// shouldn't happen, logged above
});