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.
2020-11-30 11:49:37 +00:00
|
|
|
import {expect} from "chai";
|
2020-11-30 18:01:13 +00:00
|
|
|
import {SecretKey, PublicKey, Signature, init} from "../../src";
|
2020-11-30 11:49:37 +00:00
|
|
|
|
|
|
|
describe("index named exports", () => {
|
|
|
|
it("Classes and methods should be defined", async () => {
|
|
|
|
await init("herumi");
|
|
|
|
|
2020-11-30 18:01:13 +00:00
|
|
|
const sk = SecretKey.fromKeygen();
|
2020-11-30 11:49:37 +00:00
|
|
|
const msg = new Uint8Array(32);
|
|
|
|
const sig = sk.sign(msg);
|
|
|
|
const pk = sk.toPublicKey();
|
|
|
|
expect(verifyHelper(pk, sig, msg)).to.be.true;
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sample helper to test argument typing
|
|
|
|
*/
|
|
|
|
function verifyHelper(pk: PublicKey, sig: Signature, msg: Uint8Array): boolean {
|
|
|
|
return sig.verify(pk, msg);
|
|
|
|
}
|
|
|
|
});
|