Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit fb5a190

Browse files
committed
Disable dials to multiaddrs without certhashes
1 parent e76b7ae commit fb5a190

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ class WebTransport implements Transport {
294294

295295
const { url, certhashes, remotePeer } = parseMultiaddr(ma)
296296

297+
if (certhashes.length === 0) {
298+
throw new Error('Expected multiaddr to contain certhashes')
299+
}
300+
297301
const wt = new window.WebTransport(`${url}/.well-known/libp2p-webtransport?type=noise`, {
298302
serverCertificateHashes: certhashes.map(certhash => ({
299303
algorithm: 'sha-256',

0 commit comments

Comments
 (0)