@@ -28,8 +28,14 @@ describe('Noise', () => {
28
28
29
29
it ( 'should communicate through encrypted streams without noise pipes' , async ( ) => {
30
30
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 } )
33
39
34
40
const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
35
41
const [ outbound , inbound ] = await Promise . all ( [
@@ -51,8 +57,14 @@ describe('Noise', () => {
51
57
it ( 'should test large payloads' , async function ( ) {
52
58
this . timeout ( 10000 )
53
59
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 } )
56
68
57
69
const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
58
70
const [ outbound , inbound ] = await Promise . all ( [
@@ -76,9 +88,15 @@ describe('Noise', () => {
76
88
it ( 'should working without remote peer provided in incoming connection' , async ( ) => {
77
89
try {
78
90
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 } )
80
95
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 } )
82
100
83
101
const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
84
102
const [ outbound , inbound ] = await Promise . all ( [
@@ -109,10 +127,16 @@ describe('Noise', () => {
109
127
try {
110
128
const certhashInit = Buffer . from ( 'certhash data from init' )
111
129
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 ] } } )
113
134
const staticKeysResponder = pureJsCrypto . generateX25519KeyPair ( )
114
135
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 ] } } )
116
140
117
141
const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
118
142
const [ outbound , inbound ] = await Promise . all ( [
@@ -130,8 +154,14 @@ describe('Noise', () => {
130
154
131
155
it ( 'should accept a prologue' , async ( ) => {
132
156
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' ) } )
135
165
136
166
const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array | Uint8ArrayList > ( )
137
167
const [ outbound , inbound ] = await Promise . all ( [
0 commit comments