*Make bls export an async wrapper to prevent top-level await
This commit is contained in:
parent
902896968f
commit
d58fc82e08
|
@ -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":
|
||||
|
|
|
@ -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 = {
|
||||
implementation: "herumi",
|
||||
SecretKey,
|
||||
PublicKey,
|
||||
Signature,
|
||||
export const bls = async (): Promise<IBls> => {
|
||||
await init();
|
||||
return {
|
||||
implementation: "herumi",
|
||||
SecretKey,
|
||||
PublicKey,
|
||||
Signature,
|
||||
|
||||
...functionalInterfaceFactory({SecretKey, PublicKey, Signature}),
|
||||
...functionalInterfaceFactory({SecretKey, PublicKey, Signature}),
|
||||
};
|
||||
};
|
||||
|
||||
export default bls;
|
||||
|
|
Reference in New Issue