mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 07:22:36 +00:00
Remove unused
This commit is contained in:
parent
ddfacf81e8
commit
5be8f61599
@ -81,7 +81,7 @@ export class Handshake {
|
||||
}
|
||||
|
||||
// stage 2
|
||||
async finish(earlyData?: bytes): Promise<void> {
|
||||
async finish(): Promise<void> {
|
||||
if (this.isInitiator) {
|
||||
logger('Stage 2 - Initiator sending third handshake message.');
|
||||
const messageBuffer = this.xx.sendMessage(this.session, this.payload);
|
||||
|
@ -3,7 +3,7 @@ import { BN } from 'bn.js';
|
||||
|
||||
import { bytes32, bytes } from '../@types/basic'
|
||||
import { KeyPair } from '../@types/libp2p'
|
||||
import {generateKeypair, getHkdf, isValidPublicKey} from '../utils';
|
||||
import {generateKeypair, isValidPublicKey} from '../utils';
|
||||
import { HandshakeState, MessageBuffer, NoiseSession } from "../@types/handshake";
|
||||
import {AbstractHandshake} from "./abstract-handshake";
|
||||
|
||||
|
@ -8,12 +8,8 @@ import lp from 'it-length-prefixed';
|
||||
|
||||
import { Handshake } from "./handshake";
|
||||
import {
|
||||
createHandshakePayload,
|
||||
generateKeypair,
|
||||
getHandshakePayload,
|
||||
getPayload,
|
||||
signEarlyDataPayload,
|
||||
signPayload
|
||||
} from "./utils";
|
||||
import { uint16BEDecode, uint16BEEncode } from "./encoder";
|
||||
import { decryptStream, encryptStream } from "./crypto";
|
||||
@ -86,13 +82,13 @@ export class Noise implements NoiseConnection {
|
||||
remotePeer: PeerId,
|
||||
): Promise<Handshake> {
|
||||
const prologue = Buffer.from(this.protocol);
|
||||
const payload = await getPayload(localPeer, this.staticKeys.publicKey);
|
||||
const payload = await getPayload(localPeer, this.staticKeys.publicKey, this.earlyData);
|
||||
const handshake = new Handshake(isInitiator, payload, prologue, this.staticKeys, connection, remotePeer);
|
||||
|
||||
try {
|
||||
await handshake.propose();
|
||||
await handshake.exchange();
|
||||
await handshake.finish(this.earlyData);
|
||||
await handshake.finish();
|
||||
} catch (e) {
|
||||
throw new Error(`Error occurred during handshake: ${e.message}`);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { x25519, ed25519, HKDF, SHA256 } from 'bcrypto';
|
||||
import { x25519, HKDF, SHA256 } from 'bcrypto';
|
||||
import protobuf from "protobufjs";
|
||||
import { Buffer } from "buffer";
|
||||
import PeerId from "peer-id";
|
||||
|
Loading…
x
Reference in New Issue
Block a user