Tweaks and upgrade karma/webpack

This commit is contained in:
Cayman 2022-04-14 12:16:06 -05:00
parent 8e8447d2f9
commit 7c2e883527
No known key found for this signature in database
GPG Key ID: 54B21AEC3C53E1F5
27 changed files with 911 additions and 2760 deletions

View File

@ -4,17 +4,26 @@ const webpackConfig = require("./webpack.config.cjs");
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: "", basePath: "",
frameworks: ["mocha", "chai"], frameworks: [
files: ["test/unit-web/run-web-implementation.test.ts", "test/unit/index-named-exports.test.ts"], "webpack",
"mocha",
//"chai",
],
files: [
"test/unit-web/run-web-implementation.test.ts",
"test/unit/index-named-exports.test.ts",
],
exclude: [], exclude: [],
preprocessors: { preprocessors: {
"test/**/*.ts": ["webpack"], "test/**/*.ts": ["webpack"],
}, },
webpack: { webpack: {
mode: "production", mode: "production",
node: webpackConfig.node,
module: webpackConfig.module, module: webpackConfig.module,
resolve: webpackConfig.resolve, resolve: webpackConfig.resolve,
experiments: webpackConfig.experiments,
optimization: webpackConfig.optimization,
stats: {warnings:false},
}, },
reporters: ["spec"], reporters: ["spec"],

View File

@ -33,8 +33,8 @@
] ]
} }
}, },
"module": "./browser", "module": "./lib/index.js",
"browser": "./browser", "browser": "./lib/herumi.js",
"homepage": "https://github.com/chainsafe/bls", "homepage": "https://github.com/chainsafe/bls",
"author": "ChainSafe Systems", "author": "ChainSafe Systems",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -83,26 +83,27 @@
"@types/randombytes": "^2.0.0", "@types/randombytes": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1", "@typescript-eslint/parser": "^4.31.1",
"buffer": "^6.0.3",
"chai": "^4.3.6", "chai": "^4.3.6",
"eslint": "^7.14.0", "eslint": "^7.14.0",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.1",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",
"karma": "^4.4.1", "karma": "^6.3.18",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0", "karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0", "karma-cli": "^2.0.0",
"karma-mocha": "^1.3.0", "karma-mocha": "^2.0.1",
"karma-spec-reporter": "^0.0.32", "karma-spec-reporter": "^0.0.32",
"karma-webpack": "^4.0.2", "karma-webpack": "^5.0.0",
"mocha": "^9.2.2", "mocha": "^9.2.2",
"nyc": "^15.0.0", "nyc": "^15.0.0",
"prettier": "^2.1.2", "prettier": "^2.1.2",
"resolve-typescript-plugin": "^1.1.5", "resolve-typescript-plugin": "^1.2.0",
"ts-loader": "^8.3.0", "ts-loader": "^9.2.8",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.3", "typescript": "^4.6.3",
"webpack": "^4.30.0", "webpack": "^5.72.0",
"webpack-cli": "^3.3.2" "webpack-cli": "^4.9.2"
}, },
"resolutions": { "resolutions": {
"mocha": "^9.2.2", "mocha": "^9.2.2",

View File

@ -1,7 +1,7 @@
import {SecretKey} from "./secretKey.js"; import {SecretKey} from "./secretKey.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {Signature} from "./signature.js"; import {Signature} from "./signature.js";
import {IBls} from "../interface.js"; import {IBls} from "../types.js";
import {functionalInterfaceFactory} from "../functional.js"; import {functionalInterfaceFactory} from "../functional.js";
export * from "../constants.js"; export * from "../constants.js";

View File

@ -1,7 +1,7 @@
import * as blst from "@chainsafe/blst"; import * as blst from "@chainsafe/blst";
import {EmptyAggregateError} from "../errors.js"; import {EmptyAggregateError} from "../errors.js";
import {bytesToHex, hexToBytes} from "../helpers/index.js"; import {bytesToHex, hexToBytes} from "../helpers/index.js";
import {PointFormat, PublicKey as IPublicKey} from "../interface.js"; import {PointFormat, PublicKey as IPublicKey} from "../types.js";
export class PublicKey extends blst.PublicKey implements IPublicKey { export class PublicKey extends blst.PublicKey implements IPublicKey {
constructor(value: ConstructorParameters<typeof blst.PublicKey>[0]) { constructor(value: ConstructorParameters<typeof blst.PublicKey>[0]) {

View File

@ -1,7 +1,7 @@
import * as blst from "@chainsafe/blst"; import * as blst from "@chainsafe/blst";
import {bytesToHex, hexToBytes, isZeroUint8Array, randomBytes} from "../helpers/index.js"; import {bytesToHex, hexToBytes, isZeroUint8Array, randomBytes} from "../helpers/index.js";
import {SECRET_KEY_LENGTH} from "../constants.js"; import {SECRET_KEY_LENGTH} from "../constants.js";
import {SecretKey as ISecretKey} from "../interface.js"; import {SecretKey as ISecretKey} from "../types.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {Signature} from "./signature.js"; import {Signature} from "./signature.js";
import {ZeroSecretKeyError} from "../errors.js"; import {ZeroSecretKeyError} from "../errors.js";

View File

@ -1,6 +1,6 @@
import * as blst from "@chainsafe/blst"; import * as blst from "@chainsafe/blst";
import {bytesToHex, hexToBytes} from "../helpers/index.js"; import {bytesToHex, hexToBytes} from "../helpers/index.js";
import {PointFormat, Signature as ISignature} from "../interface.js"; import {PointFormat, Signature as ISignature} from "../types.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {EmptyAggregateError, ZeroSignatureError} from "../errors.js"; import {EmptyAggregateError, ZeroSignatureError} from "../errors.js";

View File

@ -1,4 +1,4 @@
import {IBls} from "./interface.js"; import {IBls} from "./types.js";
import {validateBytes} from "./helpers/index.js"; import {validateBytes} from "./helpers/index.js";
import {NotInitializedError} from "./errors.js"; import {NotInitializedError} from "./errors.js";

View File

@ -1,4 +1,4 @@
import type {IBls, Implementation} from "./interface.js"; import type {IBls, Implementation} from "./types.js";
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js // Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js
const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; const isNode = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";

View File

@ -2,7 +2,7 @@ import {SecretKey} from "./secretKey.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {Signature} from "./signature.js"; import {Signature} from "./signature.js";
import {init, destroy} from "./context.js"; import {init, destroy} from "./context.js";
import {IBls} from "../interface.js"; import {IBls} from "../types.js";
import {functionalInterfaceFactory} from "../functional.js"; import {functionalInterfaceFactory} from "../functional.js";
await init(); await init();

View File

@ -1,7 +1,7 @@
import type {PublicKeyType} from "bls-eth-wasm"; import type {PublicKeyType} from "bls-eth-wasm";
import {getContext} from "./context.js"; import {getContext} from "./context.js";
import {bytesToHex, hexToBytes, isZeroUint8Array} from "../helpers/index.js"; import {bytesToHex, hexToBytes, isZeroUint8Array} from "../helpers/index.js";
import {PointFormat, PublicKey as IPublicKey} from "../interface.js"; import {PointFormat, PublicKey as IPublicKey} from "../types.js";
import {EmptyAggregateError, InvalidLengthError, ZeroPublicKeyError} from "../errors.js"; import {EmptyAggregateError, InvalidLengthError, ZeroPublicKeyError} from "../errors.js";
import {PUBLIC_KEY_LENGTH_COMPRESSED, PUBLIC_KEY_LENGTH_UNCOMPRESSED} from "../constants.js"; import {PUBLIC_KEY_LENGTH_COMPRESSED, PUBLIC_KEY_LENGTH_UNCOMPRESSED} from "../constants.js";

View File

@ -5,7 +5,7 @@ import {getContext} from "./context.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {Signature} from "./signature.js"; import {Signature} from "./signature.js";
import {bytesToHex, hexToBytes} from "../helpers/index.js"; import {bytesToHex, hexToBytes} from "../helpers/index.js";
import {SecretKey as ISecretKey} from "../interface.js"; import {SecretKey as ISecretKey} from "../types.js";
import {InvalidLengthError, ZeroSecretKeyError} from "../errors.js"; import {InvalidLengthError, ZeroSecretKeyError} from "../errors.js";
export class SecretKey implements ISecretKey { export class SecretKey implements ISecretKey {
@ -35,7 +35,7 @@ export class SecretKey implements ISecretKey {
} }
static fromKeygen(entropy?: Uint8Array): SecretKey { static fromKeygen(entropy?: Uint8Array): SecretKey {
const sk = generateRandomSecretKey(entropy && Buffer.from(entropy)); const sk = generateRandomSecretKey(entropy);
return this.fromBytes(sk); return this.fromBytes(sk);
} }

View File

@ -2,7 +2,7 @@ import type {SignatureType} from "bls-eth-wasm";
import {getContext} from "./context.js"; import {getContext} from "./context.js";
import {PublicKey} from "./publicKey.js"; import {PublicKey} from "./publicKey.js";
import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers/index.js"; import {bytesToHex, concatUint8Arrays, hexToBytes, isZeroUint8Array} from "../helpers/index.js";
import {PointFormat, Signature as ISignature, CoordType} from "../interface.js"; import {PointFormat, Signature as ISignature, CoordType} from "../types.js";
import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors.js"; import {EmptyAggregateError, InvalidLengthError, InvalidOrderError} from "../errors.js";
import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants.js"; import {SIGNATURE_LENGTH_COMPRESSED, SIGNATURE_LENGTH_UNCOMPRESSED} from "../constants.js";

View File

@ -1,4 +1,4 @@
import type {IBls} from "./interface.js"; import type {IBls} from "./types.js";
import {getImplementation} from "./getImplementation.js"; import {getImplementation} from "./getImplementation.js";
// Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js // Thanks https://github.com/iliakan/detect-node/blob/master/index.esm.js

View File

@ -1,68 +0,0 @@
export interface IBls {
implementation: Implementation;
SecretKey: typeof SecretKey;
PublicKey: typeof PublicKey;
Signature: typeof Signature;
sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
aggregatePublicKeys(publicKeys: Uint8Array[]): Uint8Array;
aggregateSignatures(signatures: Uint8Array[]): Uint8Array;
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
verifyMultipleSignatures(sets: {publicKey: Uint8Array; message: Uint8Array; signature: Uint8Array}[]): boolean;
secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array;
}
export declare class SecretKey {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
static fromBytes(bytes: Uint8Array): SecretKey;
static fromHex(hex: string): SecretKey;
static fromKeygen(entropy?: Uint8Array): SecretKey;
sign(message: Uint8Array): Signature;
toPublicKey(): PublicKey;
toBytes(): Uint8Array;
toHex(): string;
}
export declare class PublicKey {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
/** @param type Only for impl `blst-native`. Defaults to `CoordType.jacobian` */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): PublicKey;
static fromHex(hex: string): PublicKey;
static aggregate(publicKeys: PublicKey[]): PublicKey;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}
export declare class Signature {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine`
* @param validate When using `herumi` implementation, signature validation is always on regardless of this flag. */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
static fromHex(hex: string): Signature;
static aggregate(signatures: Signature[]): Signature;
static verifyMultipleSignatures(sets: {publicKey: PublicKey; message: Uint8Array; signature: Signature}[]): boolean;
verify(publicKey: PublicKey, message: Uint8Array): boolean;
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}
export type Implementation = "herumi" | "blst-native";
export enum PointFormat {
compressed = "compressed",
uncompressed = "uncompressed",
}
export enum CoordType {
affine,
jacobian,
}

View File

@ -1,4 +1,4 @@
import type {IBls, Implementation} from "./interface.js"; import type {IBls, Implementation} from "./types.js";
import {getImplementation} from "./getImplementation.js"; import {getImplementation} from "./getImplementation.js";
// TODO: Use a Proxy for example to throw an error if it's not initialized yet // TODO: Use a Proxy for example to throw an error if it's not initialized yet

View File

@ -1 +1,68 @@
export * from "./interface.js"; export interface IBls {
implementation: Implementation;
SecretKey: typeof SecretKey;
PublicKey: typeof PublicKey;
Signature: typeof Signature;
sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
aggregatePublicKeys(publicKeys: Uint8Array[]): Uint8Array;
aggregateSignatures(signatures: Uint8Array[]): Uint8Array;
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
verifyMultipleSignatures(sets: {publicKey: Uint8Array; message: Uint8Array; signature: Uint8Array}[]): boolean;
secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array;
}
export declare class SecretKey {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
static fromBytes(bytes: Uint8Array): SecretKey;
static fromHex(hex: string): SecretKey;
static fromKeygen(entropy?: Uint8Array): SecretKey;
sign(message: Uint8Array): Signature;
toPublicKey(): PublicKey;
toBytes(): Uint8Array;
toHex(): string;
}
export declare class PublicKey {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
/** @param type Only for impl `blst-native`. Defaults to `CoordType.jacobian` */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): PublicKey;
static fromHex(hex: string): PublicKey;
static aggregate(publicKeys: PublicKey[]): PublicKey;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}
export declare class Signature {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private constructor(...value: any);
/** @param type Only for impl `blst-native`. Defaults to `CoordType.affine`
* @param validate When using `herumi` implementation, signature validation is always on regardless of this flag. */
static fromBytes(bytes: Uint8Array, type?: CoordType, validate?: boolean): Signature;
static fromHex(hex: string): Signature;
static aggregate(signatures: Signature[]): Signature;
static verifyMultipleSignatures(sets: {publicKey: PublicKey; message: Uint8Array; signature: Signature}[]): boolean;
verify(publicKey: PublicKey, message: Uint8Array): boolean;
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
/** @param format Defaults to `PointFormat.compressed` */
toBytes(format?: PointFormat): Uint8Array;
toHex(format?: PointFormat): string;
}
export type Implementation = "herumi" | "blst-native";
export enum PointFormat {
compressed = "compressed",
uncompressed = "uncompressed",
}
export enum CoordType {
affine,
jacobian,
}

View File

@ -1,6 +1,6 @@
import blst from "../src/blst-native/index.js"; import blst from "../src/blst-native/index.js";
import herumi from "../src/herumi/index.js"; import herumi from "../src/herumi/index.js";
import {IBls} from "../src/interface.js"; import {IBls} from "../src/types.js";
export type Implementation = "blst" | "herumi"; export type Implementation = "blst" | "herumi";
@ -19,7 +19,6 @@ export async function runForAllImplementations(
): Promise<void> { ): Promise<void> {
for (const implementation of ["blst", "herumi"] as Implementation[]) { for (const implementation of ["blst", "herumi"] as Implementation[]) {
const bls = getBls(implementation); const bls = getBls(implementation);
await bls.init();
callback(bls, implementation); callback(bls, implementation);
} }
} }
@ -27,10 +26,6 @@ export async function runForAllImplementations(
export function describeForAllImplementations(callback: (bls: IBls) => void): void { export function describeForAllImplementations(callback: (bls: IBls) => void): void {
runForAllImplementations((bls, implementation) => { runForAllImplementations((bls, implementation) => {
describe(implementation, function () { describe(implementation, function () {
before(async () => {
await bls.init();
});
try { try {
callback(bls); callback(bls);
} catch (e) { } catch (e) {

View File

@ -1,18 +1,12 @@
import herumi from "../../src/herumi/index.js"; import herumi from "../../src/herumi/index.js";
import {runSecretKeyTests} from "../unit/secretKey.test"; import {runSecretKeyTests} from "../unit/secretKey.test.js";
import {runPublicKeyTests} from "../unit/publicKey.test"; import {runPublicKeyTests} from "../unit/publicKey.test.js";
import {runIndexTests} from "../unit/index.test"; import {runIndexTests} from "../unit/index.test.js";
// This file is intended to be compiled and run by Karma // This file is intended to be compiled and run by Karma
// Do not import the node.bindings or it will break with: // Do not import the node.bindings or it will break with:
// Error: BLST bindings loader should only run in a NodeJS context: process.platform // Error: BLST bindings loader should only run in a NodeJS context: process.platform
describe("herumi", () => { describe("herumi", () => {
before(async () => {
// For consistency with describeForAllImplementations
// eslint-disable-next-line import/no-named-as-default-member
await herumi.init();
});
runSecretKeyTests(herumi); runSecretKeyTests(herumi);
runPublicKeyTests(herumi); runPublicKeyTests(herumi);
runIndexTests(herumi); runIndexTests(herumi);

View File

@ -1,11 +1,9 @@
import {expect} from "chai"; import {expect} from "chai";
import {init, bls} from "../../src/index.js"; import bls from "../../src/index.js";
import type {SecretKey, PublicKey, Signature} from "../../src/types.js"; import type {SecretKey, PublicKey, Signature} from "../../src/types.js";
describe("types named exports", () => { describe("types named exports", () => {
it("Classes and methods should be defined", async () => { it("Classes and methods should be defined", async () => {
await init("herumi");
/** /**
* Sample helper to test argument typing * Sample helper to test argument typing
*/ */

View File

@ -1,6 +1,7 @@
import {expect} from "chai"; import {expect} from "chai";
import {IBls, PointFormat} from "../../src/interface.js"; import {Buffer} from "buffer";
import {getN, randomMessage, hexToBytesNode} from "../util.js"; import {IBls, PointFormat} from "../../src/types.js";
import {getN, randomMessage} from "../util.js";
import {hexToBytes} from "../../src/helpers/index.js"; import {hexToBytes} from "../../src/helpers/index.js";
import {maliciousVerifyMultipleSignaturesData} from "../data/malicious-signature-test-data.js"; import {maliciousVerifyMultipleSignaturesData} from "../data/malicious-signature-test-data.js";
@ -178,13 +179,13 @@ export function runIndexTests(bls: IBls): void {
"0x0a1a1c26055a329817a5759d877a2795f9499b97d6056edde0eea39512f24e8bc874b4471f0501127abb1ea0d9f68ac111392125a1c3750363c2c97d9650fb78696e6428db8ff9efaf0471cbfd20324916ab545746db83756d335e92f9e8c8b8"; "0x0a1a1c26055a329817a5759d877a2795f9499b97d6056edde0eea39512f24e8bc874b4471f0501127abb1ea0d9f68ac111392125a1c3750363c2c97d9650fb78696e6428db8ff9efaf0471cbfd20324916ab545746db83756d335e92f9e8c8b8";
it("Should serialize comp pubkey", () => { it("Should serialize comp pubkey", () => {
const sk = bls.SecretKey.fromBytes(hexToBytesNode(skHex)); const sk = bls.SecretKey.fromBytes(hexToBytes(skHex));
const pkHexComp = sk.toPublicKey().toHex(PointFormat.compressed); const pkHexComp = sk.toPublicKey().toHex(PointFormat.compressed);
expect(pkHexComp).to.equal(pkHexCompExpected, "Wrong pkHexComp"); expect(pkHexComp).to.equal(pkHexCompExpected, "Wrong pkHexComp");
}); });
it("Should serialize uncomp pubkey", () => { it("Should serialize uncomp pubkey", () => {
const sk = bls.SecretKey.fromBytes(hexToBytesNode(skHex)); const sk = bls.SecretKey.fromBytes(hexToBytes(skHex));
const pkHexUncomp = sk.toPublicKey().toHex(PointFormat.uncompressed); const pkHexUncomp = sk.toPublicKey().toHex(PointFormat.uncompressed);
expect(pkHexUncomp).to.equal(pkHexUncompExpected, "Wrong pkHexUncomp"); expect(pkHexUncomp).to.equal(pkHexUncompExpected, "Wrong pkHexUncomp");
}); });

View File

@ -1,6 +1,5 @@
import {spawn, Pool, Worker, Thread} from "@chainsafe/threads"; import {spawn, Pool, Worker, Thread} from "@chainsafe/threads";
import {Implementation, PointFormat} from "../../../../src/index.js"; import {Implementation, PointFormat, PublicKey, Signature} from "../../../../src/types.js";
import {PublicKey, Signature} from "../../../../src/types.js";
import {WorkerApi} from "./worker.js"; import {WorkerApi} from "./worker.js";
type ThreadType = { type ThreadType = {

View File

@ -1,5 +1,5 @@
import {expect} from "chai"; import {expect} from "chai";
import {IBls} from "../../../../src/index.js"; import {IBls} from "../../../../src/types.js";
import type {PublicKey, Signature} from "../../../../src/types.js"; import type {PublicKey, Signature} from "../../../../src/types.js";
import {BlsMultiThreadNaive} from "./index.js"; import {BlsMultiThreadNaive} from "./index.js";

View File

@ -1,5 +1,6 @@
import {expose} from "@chainsafe/threads/worker"; import {expose} from "@chainsafe/threads/worker";
import {bls, init, CoordType, Implementation} from "../../../../src/index.js"; import {CoordType, Implementation} from "../../../../src/types.js";
import bls, {init} from "../../../../src/switchable.js";
export type WorkerApi = typeof workerApi; export type WorkerApi = typeof workerApi;

View File

@ -1,5 +1,5 @@
import {expect} from "chai"; import {expect} from "chai";
import {IBls} from "../../src/interface.js"; import {IBls} from "../../src/types.js";
export function runPublicKeyTests(bls: IBls): void { export function runPublicKeyTests(bls: IBls): void {
describe("PublicKey", () => { describe("PublicKey", () => {

View File

@ -1,5 +1,5 @@
import {expect} from "chai"; import {expect} from "chai";
import {IBls} from "../../src/interface.js"; import {IBls} from "../../src/types.js";
export function runSecretKeyTests(bls: IBls): void { export function runSecretKeyTests(bls: IBls): void {
describe("SecretKey", () => { describe("SecretKey", () => {

View File

@ -3,22 +3,27 @@ const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
module.exports = { module.exports = {
entry: "./src/index.ts", entry: "./src/index.ts",
mode: "production", mode: "production",
node: {
fs: "empty",
},
output: { output: {
filename: "dist/bundle.js", filename: "dist/bundle.js",
}, },
resolve: {
extensions: [".ts", ".js"],
plugins: [new ResolveTypeScriptPlugin()]
},
module: { module: {
rules: [{test: /\.(ts|js)$/, use: {loader: "ts-loader", options: {transpileOnly: true}}}], rules: [{test: /\.(ts)$/, use: {loader: "ts-loader", options: {transpileOnly: true}}}],
}, },
optimization: { optimization: {
// Disable minification for better debugging on Karma tests // Disable minification for better debugging on Karma tests
minimize: false, minimize: false,
//splitChunks: false, runtimeChunk: false,
}, },
devtool: "source-map", devtool: "source-map",
resolve: {
plugins: [new ResolveTypeScriptPlugin()],
fallback: {
crypto: false,
fs: false,
path: false,
},
},
experiments: {
topLevelAwait: true,
},
}; };

3409
yarn.lock

File diff suppressed because it is too large Load Diff