@libp2p/webrtc 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/webrtc",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A libp2p transport using WebRTC connections",
5
5
  "author": "",
6
6
  "license": "Apache-2.0 OR MIT",
@@ -135,13 +135,13 @@
135
135
  "release": "aegir release"
136
136
  },
137
137
  "dependencies": {
138
- "@chainsafe/libp2p-noise": "^10.0.0",
138
+ "@chainsafe/libp2p-noise": "^11.0.0",
139
139
  "@libp2p/interface-connection": "^3.0.2",
140
- "@libp2p/interface-peer-id": "^1.0.5",
140
+ "@libp2p/interface-peer-id": "^2.0.0",
141
141
  "@libp2p/interface-stream-muxer": "^3.0.0",
142
142
  "@libp2p/interface-transport": "^2.0.0",
143
143
  "@libp2p/logger": "^2.0.0",
144
- "@libp2p/peer-id": "^1.1.15",
144
+ "@libp2p/peer-id": "^2.0.0",
145
145
  "@multiformats/multiaddr": "^11.0.3",
146
146
  "@protobuf-ts/runtime": "^2.8.0",
147
147
  "err-code": "^3.0.1",
@@ -150,19 +150,19 @@
150
150
  "it-pipe": "^2.0.4",
151
151
  "it-pushable": "^3.1.0",
152
152
  "it-stream-types": "^1.0.4",
153
- "multiformats": "^10.0.0",
153
+ "multiformats": "^11.0.0",
154
154
  "multihashes": "^4.0.3",
155
155
  "p-defer": "^4.0.0",
156
156
  "uint8arraylist": "^2.3.3",
157
157
  "uint8arrays": "^4.0.2"
158
158
  },
159
159
  "devDependencies": {
160
- "@libp2p/interface-mocks": "^8.0.1",
161
- "@libp2p/peer-id-factory": "^1.0.19",
160
+ "@libp2p/interface-mocks": "^9.0.0",
161
+ "@libp2p/peer-id-factory": "^2.0.0",
162
162
  "@protobuf-ts/plugin": "^2.8.0",
163
163
  "@protobuf-ts/protoc": "^2.8.0",
164
164
  "aegir": "^37.6.6",
165
165
  "it-first": "^2.0.0",
166
- "libp2p": "^0.40.0"
166
+ "libp2p": "^0.41.0"
167
167
  }
168
168
  }
package/src/muxer.ts CHANGED
@@ -98,12 +98,9 @@ export class DataChannelMuxer implements StreamMuxer {
98
98
  }
99
99
  }
100
100
 
101
- /**
102
- * Initiate a new stream with the given name. If no name is
103
- * provided, the id of the stream will be used.
104
- */
105
- newStream (name: string = ''): Stream {
106
- const channel = this.peerConnection.createDataChannel(name)
101
+ newStream (): Stream {
102
+ // The spec says the label SHOULD be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label
103
+ const channel = this.peerConnection.createDataChannel('')
107
104
  const stream = new WebRTCStream({
108
105
  channel,
109
106
  stat: {
package/src/sdp.ts CHANGED
@@ -11,12 +11,8 @@ const log = logger('libp2p:webrtc:sdp')
11
11
  /**
12
12
  * Get base2 | identity decoders
13
13
  */
14
- export const mbdecoder: any = (function () {
15
- const decoders = Object.values(bases).map((b) => b.decoder)
16
- let acc = decoders[0].or(decoders[1])
17
- decoders.slice(2).forEach((d) => (acc = acc.or(d)))
18
- return acc
19
- })()
14
+ // @ts-expect-error - Not easy to combine these types.
15
+ export const mbdecoder: any = Object.values(bases).map(b => b.decoder).reduce((d, b) => d.or(b))
20
16
 
21
17
  /**
22
18
  * Get base2 | identity decoders
@@ -57,7 +53,6 @@ export function decodeCerthash (certhash: string) {
57
53
  * Extract the fingerprint from a multiaddr
58
54
  */
59
55
  export function ma2Fingerprint (ma: Multiaddr): string[] {
60
- // certhash_value is a multibase encoded multihash encoded string
61
56
  const mhdecoded = decodeCerthash(certhash(ma))
62
57
  const prefix = toSupportedHashFunction(mhdecoded.name)
63
58
  const fingerprint = mhdecoded.digest.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '')