From c8798707d9ba0b32d93eff23cef78f3ceca087f0 Mon Sep 17 00:00:00 2001 From: dapplion Date: Thu, 3 Dec 2020 19:09:15 +0000 Subject: [PATCH] Remove 2 tsconfig-ignore --- src/herumi/context.ts | 10 ++++++++-- tsconfig.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/herumi/context.ts b/src/herumi/context.ts index 5a56065..b23997c 100644 --- a/src/herumi/context.ts +++ b/src/herumi/context.ts @@ -6,15 +6,21 @@ type Bls = typeof bls; let blsGlobal: Bls | null = null; let blsGlobalPromise: Promise | null = null; +// Patch to fix multiVerify() calls on a browser with polyfilled NodeJS crypto +declare global { + interface Window { + msCrypto: typeof window["crypto"]; + } +} + 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; + // getRandomValues is not typed in `bls-eth-wasm` because it's not meant to be exposed // @ts-ignore bls.getRandomValues = (x) => crypto.getRandomValues(x); } diff --git a/tsconfig.json b/tsconfig.json index a15932d..5b70769 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "target": "esnext", "module": "commonjs", "pretty": true, - "lib": ["esnext.bigint"], + "lib": ["esnext.bigint", "DOM"], "typeRoots": ["./node_modules/@types"], "declaration": true, "strict": true,