*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> {
|
export async function getImplementation(impl: Implementation = "herumi"): Promise<IBls> {
|
||||||
switch (impl) {
|
switch (impl) {
|
||||||
case "herumi": {
|
case "herumi": {
|
||||||
return (await import("./herumi/index.js")).bls;
|
return await (await import("./herumi/index.js")).bls();
|
||||||
}
|
}
|
||||||
|
|
||||||
case "blst-native":
|
case "blst-native":
|
||||||
|
|
|
@ -5,19 +5,19 @@ import {init, destroy} from "./context.js";
|
||||||
import {IBls} from "../types.js";
|
import {IBls} from "../types.js";
|
||||||
import {functionalInterfaceFactory} from "../functional.js";
|
import {functionalInterfaceFactory} from "../functional.js";
|
||||||
|
|
||||||
await init();
|
|
||||||
|
|
||||||
export * from "../constants.js";
|
export * from "../constants.js";
|
||||||
|
|
||||||
export {SecretKey, PublicKey, Signature, init, destroy};
|
export {SecretKey, PublicKey, Signature, init, destroy};
|
||||||
|
|
||||||
export const bls: IBls = {
|
export const bls = async (): Promise<IBls> => {
|
||||||
implementation: "herumi",
|
await init();
|
||||||
SecretKey,
|
return {
|
||||||
PublicKey,
|
implementation: "herumi",
|
||||||
Signature,
|
SecretKey,
|
||||||
|
PublicKey,
|
||||||
|
Signature,
|
||||||
|
|
||||||
...functionalInterfaceFactory({SecretKey, PublicKey, Signature}),
|
...functionalInterfaceFactory({SecretKey, PublicKey, Signature}),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default bls;
|
export default bls;
|
||||||
|
|
Reference in New Issue