@libp2p/webrtc 3.2.5-d5ef1c91 → 3.2.6
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/README.md +14 -132
- package/dist/index.min.js +8 -8
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +30 -0
- package/dist/src/index.js.map +1 -1
- package/dist/typedoc-urls.json +8 -0
- package/package.json +10 -10
- package/src/index.ts +31 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* A [libp2p transport](https://docs.libp2p.io/concepts/transports/overview/) based on [WebRTC datachannels](https://webrtc.org/).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* import { createLibp2p } from 'libp2p'
|
|
10
|
+
* import { noise } from '@chainsafe/libp2p-noise'
|
|
11
|
+
* import { multiaddr } from '@multiformats/multiaddr'
|
|
12
|
+
* import first from 'it-first'
|
|
13
|
+
* import { pipe } from 'it-pipe'
|
|
14
|
+
* import { fromString, toString } from 'uint8arrays'
|
|
15
|
+
* import { webRTC } from '@libp2p/webrtc'
|
|
16
|
+
*
|
|
17
|
+
* const node = await createLibp2p({
|
|
18
|
+
* transports: [webRTC()],
|
|
19
|
+
* connectionEncryption: [noise()],
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* await node.start()
|
|
23
|
+
*
|
|
24
|
+
* const ma = multiaddr('/ip4/0.0.0.0/udp/56093/webrtc/certhash/uEiByaEfNSLBexWBNFZy_QB1vAKEj7JAXDizRs4_SnTflsQ')
|
|
25
|
+
* const stream = await node.dialProtocol(ma, ['/my-protocol/1.0.0'])
|
|
26
|
+
* const message = `Hello js-libp2p-webrtc\n`
|
|
27
|
+
* const response = await pipe([fromString(message)], stream, async (source) => await first(source))
|
|
28
|
+
* const responseDecoded = toString(response.slice(0, response.length))
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
1
31
|
import { type WebRTCTransportDirectInit, type WebRTCDirectTransportComponents } from './private-to-public/transport.js';
|
|
2
32
|
import type { WebRTCTransportComponents, WebRTCTransportInit } from './private-to-private/transport.js';
|
|
3
33
|
import type { Transport } from '@libp2p/interface/transport';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAyB,KAAK,yBAAyB,EAAE,KAAK,+BAA+B,EAAE,MAAM,kCAAkC,CAAA;AAC9I,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE5D,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAA;IAEtC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,iBAAS,YAAY,CAAE,IAAI,CAAC,EAAE,yBAAyB,GAAG,CAAC,UAAU,EAAE,+BAA+B,KAAK,SAAS,CAEnH;AAED;;;;;;;;GAQG;AACH,iBAAS,MAAM,CAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,CAAC,UAAU,EAAE,yBAAyB,KAAK,SAAS,CAEjG;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* A [libp2p transport](https://docs.libp2p.io/concepts/transports/overview/) based on [WebRTC datachannels](https://webrtc.org/).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* import { createLibp2p } from 'libp2p'
|
|
10
|
+
* import { noise } from '@chainsafe/libp2p-noise'
|
|
11
|
+
* import { multiaddr } from '@multiformats/multiaddr'
|
|
12
|
+
* import first from 'it-first'
|
|
13
|
+
* import { pipe } from 'it-pipe'
|
|
14
|
+
* import { fromString, toString } from 'uint8arrays'
|
|
15
|
+
* import { webRTC } from '@libp2p/webrtc'
|
|
16
|
+
*
|
|
17
|
+
* const node = await createLibp2p({
|
|
18
|
+
* transports: [webRTC()],
|
|
19
|
+
* connectionEncryption: [noise()],
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* await node.start()
|
|
23
|
+
*
|
|
24
|
+
* const ma = multiaddr('/ip4/0.0.0.0/udp/56093/webrtc/certhash/uEiByaEfNSLBexWBNFZy_QB1vAKEj7JAXDizRs4_SnTflsQ')
|
|
25
|
+
* const stream = await node.dialProtocol(ma, ['/my-protocol/1.0.0'])
|
|
26
|
+
* const message = `Hello js-libp2p-webrtc\n`
|
|
27
|
+
* const response = await pipe([fromString(message)], stream, async (source) => await first(source))
|
|
28
|
+
* const responseDecoded = toString(response.slice(0, response.length))
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
1
31
|
import { WebRTCTransport } from './private-to-private/transport.js';
|
|
2
32
|
import { WebRTCDirectTransport } from './private-to-public/transport.js';
|
|
3
33
|
/**
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAwE,MAAM,kCAAkC,CAAA;AAsC9I;;;;;;;GAOG;AACH,SAAS,YAAY,CAAE,IAAgC;IACrD,OAAO,CAAC,UAA2C,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrG,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAE,IAA0B;IACzC,OAAO,CAAC,UAAqC,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACzF,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAwE,MAAM,kCAAkC,CAAA;AAsC9I;;;;;;;GAOG;AACH,SAAS,YAAY,CAAE,IAAgC;IACrD,OAAO,CAAC,UAA2C,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrG,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAE,IAA0B;IACzC,OAAO,CAAC,UAAqC,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACzF,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DataChannelOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.DataChannelOptions.html",
|
|
3
|
+
".:DataChannelOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_webrtc.DataChannelOptions.html",
|
|
4
|
+
"webRTC": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTC.html",
|
|
5
|
+
".:webRTC": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTC.html",
|
|
6
|
+
"webRTCDirect": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTCDirect.html",
|
|
7
|
+
".:webRTCDirect": "https://libp2p.github.io/js-libp2p/functions/_libp2p_webrtc.webRTCDirect.html"
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/webrtc",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "A libp2p transport using WebRTC connections",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/transport-webrtc#readme",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@chainsafe/libp2p-noise": "^13.0.0",
|
|
49
|
-
"@libp2p/interface": "0.1.
|
|
50
|
-
"@libp2p/interface-internal": "0.1.
|
|
51
|
-
"@libp2p/logger": "3.0.
|
|
52
|
-
"@libp2p/peer-id": "3.0.
|
|
49
|
+
"@libp2p/interface": "^0.1.5",
|
|
50
|
+
"@libp2p/interface-internal": "^0.1.8",
|
|
51
|
+
"@libp2p/logger": "^3.0.5",
|
|
52
|
+
"@libp2p/peer-id": "^3.0.5",
|
|
53
53
|
"@multiformats/mafmt": "^12.1.2",
|
|
54
54
|
"@multiformats/multiaddr": "^12.1.5",
|
|
55
55
|
"@multiformats/multiaddr-matcher": "^1.0.1",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@chainsafe/libp2p-yamux": "^5.0.0",
|
|
78
|
-
"@libp2p/interface-compliance-tests": "4.1.
|
|
79
|
-
"@libp2p/peer-id-factory": "3.0.
|
|
80
|
-
"@libp2p/websockets": "7.0.
|
|
78
|
+
"@libp2p/interface-compliance-tests": "^4.1.3",
|
|
79
|
+
"@libp2p/peer-id-factory": "^3.0.7",
|
|
80
|
+
"@libp2p/websockets": "^7.0.11",
|
|
81
81
|
"@types/sinon": "^10.0.15",
|
|
82
82
|
"aegir": "^41.0.2",
|
|
83
83
|
"delay": "^6.0.0",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"it-length": "^3.0.2",
|
|
86
86
|
"it-map": "^3.0.3",
|
|
87
87
|
"it-pair": "^2.0.6",
|
|
88
|
-
"libp2p": "0.46.
|
|
88
|
+
"libp2p": "^0.46.17",
|
|
89
89
|
"p-retry": "^6.1.0",
|
|
90
90
|
"protons": "^7.0.2",
|
|
91
91
|
"sinon": "^17.0.0",
|
|
92
|
-
"sinon-ts": "^
|
|
92
|
+
"sinon-ts": "^2.0.0"
|
|
93
93
|
},
|
|
94
94
|
"browser": {
|
|
95
95
|
"./dist/src/webrtc/index.js": "./dist/src/webrtc/index.browser.js"
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* A [libp2p transport](https://docs.libp2p.io/concepts/transports/overview/) based on [WebRTC datachannels](https://webrtc.org/).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* import { createLibp2p } from 'libp2p'
|
|
10
|
+
* import { noise } from '@chainsafe/libp2p-noise'
|
|
11
|
+
* import { multiaddr } from '@multiformats/multiaddr'
|
|
12
|
+
* import first from 'it-first'
|
|
13
|
+
* import { pipe } from 'it-pipe'
|
|
14
|
+
* import { fromString, toString } from 'uint8arrays'
|
|
15
|
+
* import { webRTC } from '@libp2p/webrtc'
|
|
16
|
+
*
|
|
17
|
+
* const node = await createLibp2p({
|
|
18
|
+
* transports: [webRTC()],
|
|
19
|
+
* connectionEncryption: [noise()],
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* await node.start()
|
|
23
|
+
*
|
|
24
|
+
* const ma = multiaddr('/ip4/0.0.0.0/udp/56093/webrtc/certhash/uEiByaEfNSLBexWBNFZy_QB1vAKEj7JAXDizRs4_SnTflsQ')
|
|
25
|
+
* const stream = await node.dialProtocol(ma, ['/my-protocol/1.0.0'])
|
|
26
|
+
* const message = `Hello js-libp2p-webrtc\n`
|
|
27
|
+
* const response = await pipe([fromString(message)], stream, async (source) => await first(source))
|
|
28
|
+
* const responseDecoded = toString(response.slice(0, response.length))
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
|
|
1
32
|
import { WebRTCTransport } from './private-to-private/transport.js'
|
|
2
33
|
import { WebRTCDirectTransport, type WebRTCTransportDirectInit, type WebRTCDirectTransportComponents } from './private-to-public/transport.js'
|
|
3
34
|
import type { WebRTCTransportComponents, WebRTCTransportInit } from './private-to-private/transport.js'
|