@@ -13,7 +13,7 @@ import { stablelib } from '../src/crypto/stablelib.js'
1313import { decode0 , decode2 , encode1 , uint16BEDecode , uint16BEEncode } from '../src/encoder.js'
1414import { XX } from '../src/handshakes/xx.js'
1515import { XXHandshake } from '../src/handshake-xx.js'
16- import { Noise } from '../src/index .js'
16+ import { Noise } from '../src/noise .js'
1717import { createHandshakePayload , getHandshakePayload , getPayload , signPayload } from '../src/utils.js'
1818import { createPeerIdsFromFixtures } from './fixtures/peer.js'
1919import { getKeyPairFromPeerId } from './utils.js'
@@ -32,8 +32,8 @@ describe('Noise', () => {
3232
3333 it ( 'should communicate through encrypted streams without noise pipes' , async ( ) => {
3434 try {
35- const noiseInit = new Noise ( undefined , undefined )
36- const noiseResp = new Noise ( undefined , undefined )
35+ const noiseInit = new Noise ( { staticNoiseKey : undefined , extensions : undefined } )
36+ const noiseResp = new Noise ( { staticNoiseKey : undefined , extensions : undefined } )
3737
3838 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
3939 const [ outbound , inbound ] = await Promise . all ( [
@@ -53,7 +53,7 @@ describe('Noise', () => {
5353 } )
5454
5555 it ( 'should test that secureOutbound is spec compliant' , async ( ) => {
56- const noiseInit = new Noise ( undefined , undefined )
56+ const noiseInit = new Noise ( { staticNoiseKey : undefined } )
5757 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
5858
5959 const [ outbound , { wrapped, handshake } ] = await Promise . all ( [
@@ -108,8 +108,8 @@ describe('Noise', () => {
108108 it ( 'should test large payloads' , async function ( ) {
109109 this . timeout ( 10000 )
110110 try {
111- const noiseInit = new Noise ( undefined , undefined )
112- const noiseResp = new Noise ( undefined , undefined )
111+ const noiseInit = new Noise ( { staticNoiseKey : undefined } )
112+ const noiseResp = new Noise ( { staticNoiseKey : undefined } )
113113
114114 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
115115 const [ outbound , inbound ] = await Promise . all ( [
@@ -133,9 +133,9 @@ describe('Noise', () => {
133133 it ( 'should working without remote peer provided in incoming connection' , async ( ) => {
134134 try {
135135 const staticKeysInitiator = stablelib . generateX25519KeyPair ( )
136- const noiseInit = new Noise ( staticKeysInitiator . privateKey )
136+ const noiseInit = new Noise ( { staticNoiseKey : staticKeysInitiator . privateKey } )
137137 const staticKeysResponder = stablelib . generateX25519KeyPair ( )
138- const noiseResp = new Noise ( staticKeysResponder . privateKey )
138+ const noiseResp = new Noise ( { staticNoiseKey : staticKeysResponder . privateKey } )
139139
140140 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
141141 const [ outbound , inbound ] = await Promise . all ( [
@@ -166,10 +166,10 @@ describe('Noise', () => {
166166 try {
167167 const certhashInit = Buffer . from ( 'certhash data from init' )
168168 const staticKeysInitiator = stablelib . generateX25519KeyPair ( )
169- const noiseInit = new Noise ( staticKeysInitiator . privateKey , { webtransportCerthashes : [ certhashInit ] } )
169+ const noiseInit = new Noise ( { staticNoiseKey : staticKeysInitiator . privateKey , extensions : { webtransportCerthashes : [ certhashInit ] } } )
170170 const staticKeysResponder = stablelib . generateX25519KeyPair ( )
171171 const certhashResp = Buffer . from ( 'certhash data from respon' )
172- const noiseResp = new Noise ( staticKeysResponder . privateKey , { webtransportCerthashes : [ certhashResp ] } )
172+ const noiseResp = new Noise ( { staticNoiseKey : staticKeysResponder . privateKey , extensions : { webtransportCerthashes : [ certhashResp ] } } )
173173
174174 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
175175 const [ outbound , inbound ] = await Promise . all ( [
@@ -187,8 +187,8 @@ describe('Noise', () => {
187187
188188 it ( 'should accept a prologue' , async ( ) => {
189189 try {
190- const noiseInit = new Noise ( undefined , undefined , stablelib , Buffer . from ( 'Some prologue' ) )
191- const noiseResp = new Noise ( undefined , undefined , stablelib , Buffer . from ( 'Some prologue' ) )
190+ const noiseInit = new Noise ( { staticNoiseKey : undefined , crypto : stablelib , prologueBytes : Buffer . from ( 'Some prologue' ) } )
191+ const noiseResp = new Noise ( { staticNoiseKey : undefined , crypto : stablelib , prologueBytes : Buffer . from ( 'Some prologue' ) } )
192192
193193 const [ inboundConnection , outboundConnection ] = duplexPair < Uint8Array > ( )
194194 const [ outbound , inbound ] = await Promise . all ( [
0 commit comments