Skip to content

Commit

Permalink
wip: test failing for a seemingly decent reason
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed May 5, 2022
1 parent 5dc94b1 commit 1200fbf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/bindings.ts
@@ -1,21 +1,21 @@
import {getBinaryPath} from "./scripts/paths";
// eslint-disable-next-line
export const blst: Blst = require(getBinaryPath());
// export const blst: Blst = await import("./blst/build/blst.js");
// @ts-ignore
export const blst: Blst = require("../blst/build/blst.js");

export interface Blst {
BLS12_381_G1: P1_Affine;
BLS12_381_NEG_G1: P1_Affine;
BLS12_381_G2: P2_Affine;
BLS12_381_NEG_G2: P2_Affine;
// BLS12_381_G1: P1_Affine;
// BLS12_381_NEG_G1: P1_Affine;
// BLS12_381_G2: P2_Affine;
// BLS12_381_NEG_G2: P2_Affine;
SecretKey: SecretKeyConstructor;
P1_Affine: P1_AffineConstructor;
P2_Affine: P2_AffineConstructor;
P1: P1Constructor;
P2: P2Constructor;
PT: PTConstructor;
Pairing: PairingConstructor;
G1(): P1;
G2(): P2;
// G1(): P1;
// G2(): P2;
}

// blst.hpp types
Expand Down
2 changes: 2 additions & 0 deletions test/browser/.gitignore
@@ -0,0 +1,2 @@
bundle.js*
blst.wasm
24 changes: 24 additions & 0 deletions test/browser/index.html
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mocha Tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>

<script src="https://unpkg.com/chai/chai.js"></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>

<script class="mocha-init">
mocha.setup('bdd');
mocha.checkLeaks();
</script>
<script src="bundle.js"></script>
<script class="mocha-exec">
mocha.run();
</script>
</body>
</html>
6 changes: 6 additions & 0 deletions test/unit/bindings/blst-sample-case.test.ts
@@ -1,6 +1,12 @@
import {blst} from "../../../src/bindings";

describe("blst sample case", () => {
before(async () => {
await new Promise((resolve) => {
setTimeout(resolve, 500);
});
});

it("Should verify a signature", () => {
const msg = "assertion"; // this what we're signing
const DST = "MY-DST"; // domain separation tag
Expand Down

0 comments on commit 1200fbf

Please sign in to comment.