*Make bls export an async wrapper to prevent top-level await

This commit is contained in:
Derrick Hammer 2023-04-08 22:20:32 -04:00
parent 902896968f
commit d58fc82e08
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 10 additions and 10 deletions

View File

@ -6,7 +6,7 @@ const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? p
export async function getImplementation(impl: Implementation = "herumi"): Promise<IBls> {
switch (impl) {
case "herumi": {
return (await import("./herumi/index.js")).bls;
return await (await import("./herumi/index.js")).bls();
}
case "blst-native":

View File

@ -5,19 +5,19 @@ import {init, destroy} from "./context.js";
import {IBls} from "../types.js";
import {functionalInterfaceFactory} from "../functional.js";
await init();
export * from "../constants.js";
export {SecretKey, PublicKey, Signature, init, destroy};
export const bls: IBls = {
export const bls = async (): Promise<IBls> => {
await init();
return {
implementation: "herumi",
SecretKey,
PublicKey,
Signature,
...functionalInterfaceFactory({SecretKey, PublicKey, Signature}),
};
};
export default bls;