This repository has been archived on 2023-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
chainsafe-bls/test/spec/priv_to_public.test.ts

33 lines
793 B
TypeScript
Raw Normal View History

2019-12-02 12:44:45 +00:00
import bls, {initBLS} from "../../src";
2019-09-05 13:06:46 +00:00
import {describeDirectorySpecTest, InputType} from "@chainsafe/eth2.0-spec-test-util/lib/single";
import path from "path";
2019-08-05 15:48:26 +00:00
interface IPrivToPubTestCase {
data: {
input: string;
output: string;
};
2019-09-05 13:06:46 +00:00
}
2019-11-27 20:58:41 +00:00
before(async function f() {
2019-12-02 12:44:45 +00:00
await initBLS();
2019-11-27 20:58:41 +00:00
});
describeDirectorySpecTest<IPrivToPubTestCase, string>(
"priv_to_pub",
path.join(
__dirname,
"../../../../node_modules/@chainsafe/eth2-spec-tests/tests/general/phase0/bls/priv_to_pub/small"
),
(testCase => {
const result = bls.generatePublicKey(Buffer.from(testCase.data.input.replace("0x", ""), "hex"));
return `0x${result.toString("hex")}`;
}),
{
inputTypes: {
data: InputType.YAML,
},
getExpected: (testCase => testCase.data.output)
}
2019-08-05 15:48:26 +00:00
);