mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-06-24 14:01:36 +00:00
Write test and resolve babel and ts compilation
This commit is contained in:
24
test/xx.test.ts
Normal file
24
test/xx.test.ts
Normal 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)
|
||||
})
|
||||
});
|
Reference in New Issue
Block a user