mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-26 13:32:30 +00:00
19 lines
525 B
TypeScript
19 lines
525 B
TypeScript
|
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;
|
||
|
}
|
||
|
}
|