@@ -28,8 +28,14 @@ describe('Noise', () => {
2828
2929 it ( 'should communicate through encrypted streams without noise pipes' , async ( ) => {
3030 try {
31- const noiseInit = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined , extensions : undefined } )
32- const noiseResp = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined , extensions : undefined } )
31+ const noiseInit = new Noise ( {
32+ peerId : localPeer ,
33+ logger : defaultLogger ( )
34+ } , { staticNoiseKey : undefined , extensions : undefined } )
35+ const noiseResp = new Noise ( {
36+ peerId : remotePeer ,
37+ logger : defaultLogger ( )
38+ } , { staticNoiseKey : undefined , extensions : undefined } )
3339
3440 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
3541 const [ outbound , inbound ] = await Promise . all ( [
@@ -51,8 +57,14 @@ describe('Noise', () => {
5157 it ( 'should test large payloads' , async function ( ) {
5258 this . timeout ( 10000 )
5359 try {
54- const noiseInit = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined } )
55- const noiseResp = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined } )
60+ const noiseInit = new Noise ( {
61+ peerId : localPeer ,
62+ logger : defaultLogger ( )
63+ } , { staticNoiseKey : undefined } )
64+ const noiseResp = new Noise ( {
65+ peerId : remotePeer ,
66+ logger : defaultLogger ( )
67+ } , { staticNoiseKey : undefined } )
5668
5769 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
5870 const [ outbound , inbound ] = await Promise . all ( [
@@ -76,9 +88,15 @@ describe('Noise', () => {
7688 it ( 'should working without remote peer provided in incoming connection' , async ( ) => {
7789 try {
7890 const staticKeysInitiator = pureJsCrypto . generateX25519KeyPair ( )
79- const noiseInit = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : staticKeysInitiator . privateKey } )
91+ const noiseInit = new Noise ( {
92+ peerId : localPeer ,
93+ logger : defaultLogger ( )
94+ } , { staticNoiseKey : staticKeysInitiator . privateKey } )
8095 const staticKeysResponder = pureJsCrypto . generateX25519KeyPair ( )
81- const noiseResp = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : staticKeysResponder . privateKey } )
96+ const noiseResp = new Noise ( {
97+ peerId : remotePeer ,
98+ logger : defaultLogger ( )
99+ } , { staticNoiseKey : staticKeysResponder . privateKey } )
82100
83101 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
84102 const [ outbound , inbound ] = await Promise . all ( [
@@ -109,10 +127,16 @@ describe('Noise', () => {
109127 try {
110128 const certhashInit = Buffer . from ( 'certhash data from init' )
111129 const staticKeysInitiator = pureJsCrypto . generateX25519KeyPair ( )
112- const noiseInit = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : staticKeysInitiator . privateKey , extensions : { webtransportCerthashes : [ certhashInit ] } } )
130+ const noiseInit = new Noise ( {
131+ peerId : localPeer ,
132+ logger : defaultLogger ( )
133+ } , { staticNoiseKey : staticKeysInitiator . privateKey , extensions : { webtransportCerthashes : [ certhashInit ] } } )
113134 const staticKeysResponder = pureJsCrypto . generateX25519KeyPair ( )
114135 const certhashResp = Buffer . from ( 'certhash data from respon' )
115- const noiseResp = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : staticKeysResponder . privateKey , extensions : { webtransportCerthashes : [ certhashResp ] } } )
136+ const noiseResp = new Noise ( {
137+ peerId : remotePeer ,
138+ logger : defaultLogger ( )
139+ } , { staticNoiseKey : staticKeysResponder . privateKey , extensions : { webtransportCerthashes : [ certhashResp ] } } )
116140
117141 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
118142 const [ outbound , inbound ] = await Promise . all ( [
@@ -130,8 +154,14 @@ describe('Noise', () => {
130154
131155 it ( 'should accept a prologue' , async ( ) => {
132156 try {
133- const noiseInit = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined , crypto : pureJsCrypto , prologueBytes : Buffer . from ( 'Some prologue' ) } )
134- const noiseResp = new Noise ( { logger : defaultLogger ( ) } , { staticNoiseKey : undefined , crypto : pureJsCrypto , prologueBytes : Buffer . from ( 'Some prologue' ) } )
157+ const noiseInit = new Noise ( {
158+ peerId : localPeer ,
159+ logger : defaultLogger ( )
160+ } , { staticNoiseKey : undefined , crypto : pureJsCrypto , prologueBytes : Buffer . from ( 'Some prologue' ) } )
161+ const noiseResp = new Noise ( {
162+ peerId : remotePeer ,
163+ logger : defaultLogger ( )
164+ } , { staticNoiseKey : undefined , crypto : pureJsCrypto , prologueBytes : Buffer . from ( 'Some prologue' ) } )
135165
136166 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
137167 const [ outbound , inbound ] = await Promise . all ( [
0 commit comments