Files
common/packages/util-crypto/src/crypto.ts
T
2022-01-10 11:48:47 +02:00

18 lines
477 B
TypeScript

// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert } from '@polkadot/util';
import { isReady, waitReady } from '@polkadot/wasm-crypto';
export const cryptoIsReady = isReady;
export function cryptoWaitReady (): Promise<boolean> {
return waitReady()
.then((): boolean => {
assert(isReady(), 'Unable to initialize @polkadot/util-crypto');
return true;
})
.catch(() => false);
}