File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,10 @@ class WebTransport implements Transport {
294
294
295
295
const { url, certhashes, remotePeer } = parseMultiaddr ( ma )
296
296
297
+ if ( certhashes . length === 0 ) {
298
+ throw new Error ( 'Expected multiaddr to contain certhashes' )
299
+ }
300
+
297
301
const wt = new window . WebTransport ( `${ url } /.well-known/libp2p-webtransport?type=noise` , {
298
302
serverCertificateHashes : certhashes . map ( certhash => ( {
299
303
algorithm : 'sha-256' ,
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ describe('libp2p-webtransport', () => {
84
84
await node . start ( )
85
85
86
86
const err = await expect ( node . dial ( ma ) ) . to . eventually . be . rejected ( )
87
- expect ( err . errors [ 0 ] . toString ( ) ) . to . contain ( 'WebTransportError: Opening handshake failed. ' )
87
+ expect ( err . errors [ 0 ] . toString ( ) ) . to . contain ( 'Expected multiaddr to contain certhashes ' )
88
88
89
89
await node . stop ( )
90
90
} )
You can’t perform that action at this time.
0 commit comments