@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/dist/index.min.js +16 -16
- package/dist/src/muxer.d.ts +1 -5
- package/dist/src/muxer.d.ts.map +1 -1
- package/dist/src/muxer.js +3 -6
- package/dist/src/muxer.js.map +1 -1
- package/dist/src/sdp.d.ts.map +1 -1
- package/dist/src/sdp.js +2 -7
- package/dist/src/sdp.js.map +1 -1
- package/dist/src/stream.d.ts +16 -10
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +74 -29
- package/dist/src/stream.js.map +1 -1
- package/dist/src/transport.d.ts.map +1 -1
- package/dist/src/transport.js +31 -31
- package/dist/src/transport.js.map +1 -1
- package/package.json +8 -8
- package/src/muxer.ts +3 -6
- package/src/sdp.ts +2 -7
- package/src/stream.ts +283 -248
- package/src/transport.ts +34 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/webrtc",
|
|
3
|
-
"version": "1.0.
|
|
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": "^
|
|
138
|
+
"@chainsafe/libp2p-noise": "^11.0.0",
|
|
139
139
|
"@libp2p/interface-connection": "^3.0.2",
|
|
140
|
-
"@libp2p/interface-peer-id": "^
|
|
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": "^
|
|
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": "^
|
|
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": "^
|
|
161
|
-
"@libp2p/peer-id-factory": "^
|
|
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.
|
|
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
|
-
|
|
103
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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'), '')
|