js-libp2p-noise/src/handshake.ts

20 lines
562 B
TypeScript
Raw Normal View History

2019-11-12 14:07:25 +01:00
import { bytes, bytes32 } from "./types/basic";
import { NoiseSession, XXHandshake } from "./xx";
import { KeyPair } from "./types/libp2p";
2019-11-11 21:58:04 +01:00
export class Handshake {
static async runXX(
isInitiator: boolean,
remotePublicKey: bytes,
prologue: bytes32,
signedPayload: bytes,
staticKeys: KeyPair,
) : Promise<NoiseSession> {
const xx = new XXHandshake();
const nsInit = await xx.initSession(isInitiator, prologue, staticKeys, remotePublicKey);
// TODO: exchange handshake messages and confirm handshake
return nsInit;
}
}