Write test and resolve babel and ts compilation

This commit is contained in:
morrigan
2019-11-04 17:06:31 +01:00
parent c542b53a4b
commit 0132590829
5 changed files with 67 additions and 11 deletions

24
test/xx.test.ts Normal file
View File

@ -0,0 +1,24 @@
import { expect } from "chai";
import { Buffer } from 'buffer';
import * as crypto from 'libp2p-crypto';
import { XXHandshake, KeyPair } from "../src/xx";
// TODO: Move this to some protocol related file
async function generateKeypair() : Promise<KeyPair> {
return await crypto.keys.generateKeyPair('ed25519');
}
describe("Index", () => {
const prologue = Buffer.from("/noise", "utf-8");
it("Test creating new XX session", async () => {
const kpInitiator: KeyPair = await generateKeypair();
const kpResponder: KeyPair = await generateKeypair();
const xx = new XXHandshake();
const session = await xx.initSession(true, prologue, kpInitiator, kpResponder.publicKey);
console.log(session)
})
});