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/unit/index-named-exports.test.ts

30 lines
864 B
TypeScript

import {expect} from "chai";
import {SecretKey, PublicKey, Signature, init, bls} from "../../src";
describe("index named exports", () => {
it("Classes and methods should be defined", async () => {
await init("herumi");
/**
* Sample helper to test argument typing
*/
function verifyHelper(pk: PublicKey, sig: Signature, msg: Uint8Array): boolean {
return sig.verify(pk, msg);
}
const sk = SecretKey.fromKeygen();
const msg = new Uint8Array(32);
const sig = sk.sign(msg);
const pk = sk.toPublicKey();
expect(verifyHelper(pk, sig, msg)).to.be.true;
});
it("Make sure exported classes are compatible with interface", () => {
const sk: SecretKey = bls.SecretKey.fromKeygen();
const pk: PublicKey = sk.toPublicKey();
const sig: Signature = sk.sign(new Uint8Array(32));
pk;
sig;
});
});