UNPKG

416 BJavaScriptView Raw
1// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
2// SPDX-License-Identifier: Apache-2.0
3import { isReady, waitReady } from '@polkadot/wasm-crypto';
4export const cryptoIsReady = isReady;
5export function cryptoWaitReady() {
6 return waitReady().then(() => {
7 if (!isReady()) {
8 throw new Error('Unable to initialize @polkadot/util-crypto');
9 }
10
11 return true;
12 }).catch(() => false);
13}
\No newline at end of file