address Pr comments

This commit is contained in:
Marin Petrunić 2019-12-02 13:44:45 +01:00
parent 8c10a06d79
commit 72f95898a8
10 changed files with 16 additions and 24 deletions

View File

@ -3,15 +3,11 @@ import {PrivateKey} from "./privateKey";
import {PublicKey} from "./publicKey"; import {PublicKey} from "./publicKey";
import {Signature} from "./signature"; import {Signature} from "./signature";
import {BLSPubkey, BLSSecretKey, BLSSignature, Domain, Hash} from "@chainsafe/eth2.0-types"; import {BLSPubkey, BLSSecretKey, BLSSignature, Domain, Hash} from "@chainsafe/eth2.0-types";
import {init} from "./context";
import {PUBLIC_KEY_LENGTH} from "./constants"; import {PUBLIC_KEY_LENGTH} from "./constants";
export {Keypair, PrivateKey, PublicKey, Signature}; export {Keypair, PrivateKey, PublicKey, Signature};
export {init as initBLS} from "./context";
export async function initLibrary(): Promise<void> {
await init();
}
/** /**
* Generates new secret and public key * Generates new secret and public key

View File

@ -1,11 +1,11 @@
// Import benchmarks // Import benchmarks
import * as suites from "./suites"; import * as suites from "./suites";
import {createReportDir, runSuite} from "@chainsafe/benchmark-utils"; import {createReportDir, runSuite} from "@chainsafe/benchmark-utils";
import {initLibrary} from "../../src"; import {initBLS} from "../../src";
// Create file // Create file
const directory: string = createReportDir(); const directory: string = createReportDir();
initLibrary().then(() => { initBLS().then(() => {
// Run benchmarks // Run benchmarks
Object.values(suites).forEach((suite) => { Object.values(suites).forEach((suite) => {
runSuite(suite(directory)); runSuite(suite(directory));

View File

@ -1,4 +1,4 @@
import bls, {initLibrary} from "../../src"; import bls, {initBLS} from "../../src";
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single"; import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
import path from "path"; import path from "path";
@ -10,7 +10,7 @@ interface IAggregatePubKeysTestCase {
} }
before(async function f() { before(async function f() {
await initLibrary(); await initBLS();
}); });
describeDirectorySpecTest<IAggregatePubKeysTestCase, string>( describeDirectorySpecTest<IAggregatePubKeysTestCase, string>(

View File

@ -1,5 +1,5 @@
import path from "path"; import path from "path";
import bls, {initLibrary} from "../../src"; import bls, {initBLS} from "../../src";
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single"; import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
interface AggregateSigsTestCase { interface AggregateSigsTestCase {
@ -10,7 +10,7 @@ interface AggregateSigsTestCase {
} }
before(async function f() { before(async function f() {
await initLibrary(); await initBLS();
}); });
describeDirectorySpecTest<AggregateSigsTestCase, string>( describeDirectorySpecTest<AggregateSigsTestCase, string>(

View File

@ -1,4 +1,4 @@
import bls, {initLibrary} from "../../src"; import bls, {initBLS} from "../../src";
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single"; import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
import path from "path"; import path from "path";
@ -10,7 +10,7 @@ interface IPrivToPubTestCase {
} }
before(async function f() { before(async function f() {
await initLibrary(); await initBLS();
}); });
describeDirectorySpecTest<IPrivToPubTestCase, string>( describeDirectorySpecTest<IPrivToPubTestCase, string>(

View File

@ -1,5 +1,5 @@
import path from "path"; import path from "path";
import bls, {initLibrary} from "../../src"; import bls, {initBLS} from "../../src";
import {padLeft} from "../../src/helpers/utils"; import {padLeft} from "../../src/helpers/utils";
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single"; import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
@ -15,7 +15,7 @@ interface ISignMessageTestCase {
} }
before(async function f() { before(async function f() {
await initLibrary(); await initBLS();
}); });
describeDirectorySpecTest<ISignMessageTestCase, string>( describeDirectorySpecTest<ISignMessageTestCase, string>(

View File

@ -1,4 +1,4 @@
import bls, {aggregatePubkeys, aggregateSignatures, initLibrary, Keypair, verify, verifyMultiple} from "../../src"; import bls, {aggregatePubkeys, aggregateSignatures, initBLS, Keypair, verify, verifyMultiple} from "../../src";
import {sha256} from "js-sha256"; import {sha256} from "js-sha256";
import {expect} from "chai"; import {expect} from "chai";
import {destroy} from "../../src/context"; import {destroy} from "../../src/context";
@ -7,7 +7,7 @@ import {padLeft} from "../../lib/helpers/utils";
describe("test bls", function () { describe("test bls", function () {
before(async function() { before(async function() {
await initLibrary(); await initBLS();
}); });
after(function () { after(function () {

View File

@ -1,6 +1,4 @@
import {PrivateKey} from "../../src/privateKey"; import {PrivateKey,PublicKey,Keypair} from "../../src";
import {PublicKey} from "../../src/publicKey";
import {Keypair} from "../../src/keypair";
import {expect} from "chai"; import {expect} from "chai";
import {destroy, init} from "../../src/context"; import {destroy, init} from "../../src/context";

View File

@ -1,4 +1,4 @@
import {PrivateKey} from "../../src/privateKey"; import {PrivateKey} from "../../src";
import {expect} from "chai"; import {expect} from "chai";
import {SECRET_KEY_LENGTH} from "../../src/constants"; import {SECRET_KEY_LENGTH} from "../../src/constants";
import {destroy, init} from "../../src/context"; import {destroy, init} from "../../src/context";

View File

@ -1,8 +1,6 @@
import {destroy, init} from "../../src/context"; import {destroy, init} from "../../src/context";
import {PublicKey} from "../../src/publicKey"; import {PublicKey, PrivateKey} from "../../src";
import {expect} from "chai"; import {expect} from "chai";
import { PrivateKey } from "../../src/privateKey";
describe("public key", function () { describe("public key", function () {