js-libp2p-noise/src/handshake.ts

19 lines
525 B
TypeScript
Raw Normal View History

2019-11-11 21:58:04 +01:00
import {bytes, bytes32} from "./types/basic";
import {KeyPair, NoiseSession, XXHandshake} from "./xx";
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;
}
}