diff --git a/src/herumi/context.ts b/src/herumi/context.ts index 7780283..5a56065 100644 --- a/src/herumi/context.ts +++ b/src/herumi/context.ts @@ -9,6 +9,16 @@ let blsGlobalPromise: Promise | null = null; export async function setupBls(): Promise { if (!blsGlobal) { await bls.init(bls.BLS12_381); + + // Patch to fix multiVerify() calls on a browser with polyfilled NodeJS crypto + // @ts-ignore + if (typeof window === "object") { + // @ts-ignore + const crypto = window.crypto || window.msCrypto; + // @ts-ignore + bls.getRandomValues = (x) => crypto.getRandomValues(x); + } + blsGlobal = bls; } }