diff --git a/src/index.ts b/src/index.ts index 145cb10..e701395 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,11 +4,16 @@ import {getImplementation} from "./getImplementation.js"; // Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; -let bls: IBls; -try { - bls = await getImplementation(isNode ? "blst-native" : "herumi"); -} catch (e) { - bls = await getImplementation("herumi"); -} +export const bls = async (): Promise => { + let bls: IBls; + + try { + bls = await getImplementation(isNode ? "blst-native" : "herumi"); + } catch (e) { + bls = await getImplementation("herumi"); + } + + return bls; +}; export default bls;