@fails-components/webtransport 0.1.0-macarmbuild.5 → 0.1.0-macarmbuild.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/CMakeLists.txt +1 -0
- package/dist/lib/client.d.ts +74 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/dom.d.ts +70 -0
- package/dist/lib/dom.d.ts.map +1 -0
- package/dist/lib/event-loop.d.ts +26 -0
- package/dist/lib/event-loop.d.ts.map +1 -0
- package/dist/lib/index.d.ts +79 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/native.d.ts +2 -0
- package/dist/lib/native.d.ts.map +1 -0
- package/dist/lib/server.d.ts +75 -0
- package/dist/lib/server.d.ts.map +1 -0
- package/dist/lib/session.d.ts +221 -0
- package/dist/lib/session.d.ts.map +1 -0
- package/dist/lib/stream.d.ts +116 -0
- package/dist/lib/stream.d.ts.map +1 -0
- package/dist/lib/transport.d.ts +25 -0
- package/dist/lib/transport.d.ts.map +1 -0
- package/dist/lib/types.d.ts +157 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/webtransport.d.ts +35 -0
- package/dist/lib/webtransport.d.ts.map +1 -0
- package/dist/test/bidirectional-streams.spec.d.ts +5 -0
- package/dist/test/bidirectional-streams.spec.d.ts.map +1 -0
- package/dist/test/datagrams.spec.d.ts +5 -0
- package/dist/test/datagrams.spec.d.ts.map +1 -0
- package/dist/test/echoclient.d.ts +2 -0
- package/dist/test/echoclient.d.ts.map +1 -0
- package/dist/test/echoserver.d.ts +2 -0
- package/dist/test/echoserver.d.ts.map +1 -0
- package/dist/test/event-loop.spec.d.ts +2 -0
- package/dist/test/event-loop.spec.d.ts.map +1 -0
- package/dist/test/fixtures/certificate.d.ts +21 -0
- package/dist/test/fixtures/certificate.d.ts.map +1 -0
- package/dist/test/fixtures/chai.d.ts +2 -0
- package/dist/test/fixtures/chai.d.ts.map +1 -0
- package/dist/test/fixtures/read-stream.d.ts +10 -0
- package/dist/test/fixtures/read-stream.d.ts.map +1 -0
- package/dist/test/fixtures/reader-value.d.ts +7 -0
- package/dist/test/fixtures/reader-value.d.ts.map +1 -0
- package/dist/test/fixtures/server.d.ts +10 -0
- package/dist/test/fixtures/server.d.ts.map +1 -0
- package/dist/test/fixtures/write-stream.d.ts +10 -0
- package/dist/test/fixtures/write-stream.d.ts.map +1 -0
- package/dist/test/test.d.ts +2 -0
- package/dist/test/test.d.ts.map +1 -0
- package/dist/test/testsuite.d.ts +25 -0
- package/dist/test/testsuite.d.ts.map +1 -0
- package/dist/test/unidirectional-streams.spec.d.ts +5 -0
- package/dist/test/unidirectional-streams.spec.d.ts.map +1 -0
- package/lib/index.js +1 -0
- package/lib/server.js +2 -1
- package/lib/types.ts +8 -0
- package/lib/utils.js +1 -2
- package/package.json +5 -2
- package/test/bidirectional-streams.spec.js +3 -2
- package/test/datagrams.spec.js +3 -2
- package/test/{event-loop.specoff.js → event-loop.spec.js} +7 -6
- package/test/fixtures/certificate.js +9 -9
- package/test/fixtures/chai.js +6 -0
- package/test/fixtures/reader-value.js +1 -2
- package/test/fixtures/write-stream.js +1 -2
- package/test/unidirectional-streams.spec.js +2 -1
- package/test/suite.specoff.js +0 -9
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* eslint-
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
|
|
2
3
|
import { createServer } from './fixtures/server.js'
|
|
3
4
|
import { getReaderValue } from './fixtures/reader-value.js'
|
|
4
5
|
import { WebTransport } from '../lib/index.js'
|
|
5
|
-
import { expect } from 'chai'
|
|
6
|
+
import { expect } from './fixtures/chai.js'
|
|
6
7
|
import { readStream } from './fixtures/read-stream.js'
|
|
7
8
|
import { writeStream } from './fixtures/write-stream.js'
|
|
8
9
|
import { defer } from '../lib/utils.js'
|
package/test/datagrams.spec.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* eslint-
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
|
|
2
3
|
import { createServer } from './fixtures/server.js'
|
|
3
4
|
import { getReaderValue } from './fixtures/reader-value.js'
|
|
4
5
|
import { WebTransport } from '../lib/index.js'
|
|
5
|
-
import { expect } from 'chai'
|
|
6
|
+
import { expect } from './fixtures/chai.js'
|
|
6
7
|
import { readStream } from './fixtures/read-stream.js'
|
|
7
8
|
import { writeStream } from './fixtures/write-stream.js'
|
|
8
9
|
import { defer } from '../lib/utils.js'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* eslint-
|
|
2
|
-
|
|
1
|
+
/* eslint-env mocha */
|
|
2
|
+
|
|
3
|
+
import { expect } from './fixtures/chai.js'
|
|
3
4
|
import { Http3EventLoop } from '../lib/event-loop.js'
|
|
4
5
|
|
|
5
|
-
describe('event-loop', () => {
|
|
6
|
+
describe.skip('event-loop', () => {
|
|
6
7
|
beforeEach(() => {
|
|
7
8
|
if (Http3EventLoop.globalLoop != null) {
|
|
8
9
|
// shut down loop, otherwise we have to wait for
|
|
@@ -12,12 +13,12 @@ describe('event-loop', () => {
|
|
|
12
13
|
})
|
|
13
14
|
|
|
14
15
|
it('should start and stop the event loop', () => {
|
|
15
|
-
expect(Http3EventLoop.globalLoop).to.be.null
|
|
16
|
+
expect(Http3EventLoop.globalLoop).to.be.null()
|
|
16
17
|
|
|
17
18
|
Http3EventLoop.createGlobalEventLoop()
|
|
18
|
-
expect(Http3EventLoop.globalLoop).to.not.be.null
|
|
19
|
+
expect(Http3EventLoop.globalLoop).to.not.be.null()
|
|
19
20
|
|
|
20
21
|
Http3EventLoop.globalLoop?.shutdownEventLoop()
|
|
21
|
-
expect(Http3EventLoop.globalLoop).to.be.null
|
|
22
|
+
expect(Http3EventLoop.globalLoop).to.be.null()
|
|
22
23
|
})
|
|
23
24
|
})
|
|
@@ -55,8 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
|
|
55
55
|
|
|
56
56
|
// @ts-expect-error node-forge has no types and @types/node-forge do not include oids
|
|
57
57
|
import forge from 'node-forge'
|
|
58
|
-
import { webcrypto as crypto } from 'crypto'
|
|
59
|
-
import { X509Certificate } from 'crypto'
|
|
58
|
+
import { webcrypto as crypto, X509Certificate } from 'crypto'
|
|
60
59
|
|
|
61
60
|
const { pki, asn1, oids } = forge
|
|
62
61
|
// taken from node-forge
|
|
@@ -111,8 +110,8 @@ function _dnToAsn1(obj) {
|
|
|
111
110
|
return rval
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
const jan_1_1950 = new Date('1950-01-01T00:00:00Z')
|
|
115
|
-
const jan_1_2050 = new Date('2050-01-01T00:00:00Z')
|
|
113
|
+
const jan_1_1950 = new Date('1950-01-01T00:00:00Z') // eslint-disable-line camelcase
|
|
114
|
+
const jan_1_2050 = new Date('2050-01-01T00:00:00Z') // eslint-disable-line camelcase
|
|
116
115
|
// taken from node-forge almost not modified
|
|
117
116
|
/**
|
|
118
117
|
* Converts a Date object to ASN.1
|
|
@@ -123,6 +122,7 @@ const jan_1_2050 = new Date('2050-01-01T00:00:00Z')
|
|
|
123
122
|
* @return the ASN.1 object representing the date.
|
|
124
123
|
*/
|
|
125
124
|
function _dateToAsn1(date) {
|
|
125
|
+
// eslint-disable-next-line camelcase
|
|
126
126
|
if (date >= jan_1_1950 && date < jan_1_2050) {
|
|
127
127
|
return asn1.create(
|
|
128
128
|
asn1.Class.UNIVERSAL,
|
|
@@ -149,10 +149,10 @@ function _dateToAsn1(date) {
|
|
|
149
149
|
* @return ASN.1 object representing signature parameters
|
|
150
150
|
*/
|
|
151
151
|
function _signatureParametersToAsn1(oid, params) {
|
|
152
|
+
const parts = []
|
|
153
|
+
|
|
152
154
|
switch (oid) {
|
|
153
155
|
case oids['RSASSA-PSS']:
|
|
154
|
-
const parts = []
|
|
155
|
-
|
|
156
156
|
if (params.hash.algorithmOid !== undefined) {
|
|
157
157
|
parts.push(
|
|
158
158
|
asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [
|
|
@@ -348,7 +348,7 @@ function toPositiveHex(hexString) {
|
|
|
348
348
|
*/
|
|
349
349
|
export async function generateWebTransportCertificate(attrs, options) {
|
|
350
350
|
try {
|
|
351
|
-
|
|
351
|
+
const keyPair = await crypto.subtle.generateKey(
|
|
352
352
|
{
|
|
353
353
|
name: 'ECDSA',
|
|
354
354
|
namedCurve: 'P-256'
|
|
@@ -371,7 +371,7 @@ export async function generateWebTransportCertificate(attrs, options) {
|
|
|
371
371
|
cert.setSubject(attrs)
|
|
372
372
|
cert.setIssuer(attrs)
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
const privateKey = crypto.subtle.exportKey('pkcs8', keyPair.privateKey)
|
|
375
375
|
const publicKey = (cert.publicKey = await crypto.subtle.exportKey(
|
|
376
376
|
'spki',
|
|
377
377
|
keyPair.publicKey
|
|
@@ -408,7 +408,7 @@ export async function generateWebTransportCertificate(attrs, options) {
|
|
|
408
408
|
oids['1.2.840.10045.4.3.2'] = 'ecdsa-with-sha256'
|
|
409
409
|
oids['ecdsa-with-sha256'] = '1.2.840.10045.4.3.2'
|
|
410
410
|
|
|
411
|
-
cert.siginfo.algorithmOid = cert.signatureOid = '1.2.840.10045.4.3.2' //'ecdsa-with-sha256'
|
|
411
|
+
cert.siginfo.algorithmOid = cert.signatureOid = '1.2.840.10045.4.3.2' // 'ecdsa-with-sha256'
|
|
412
412
|
|
|
413
413
|
cert.tbsCertificate = getTBSCertificate(cert)
|
|
414
414
|
const encoded = Buffer.from(
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* @template T
|
|
4
3
|
* @param {ReadableStream<T>} readableStream
|
|
5
4
|
* @returns {Promise<T>}
|
|
6
5
|
*/
|
|
7
|
-
export async function getReaderValue
|
|
6
|
+
export async function getReaderValue(readableStream) {
|
|
8
7
|
const reader = readableStream.getReader()
|
|
9
8
|
|
|
10
9
|
try {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* Write contents to a stream and close it
|
|
4
3
|
*
|
|
@@ -7,7 +6,7 @@
|
|
|
7
6
|
* @param {T[]} input
|
|
8
7
|
* @returns
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
export async function writeStream(writable, input) {
|
|
11
10
|
const writer = writable.getWriter()
|
|
12
11
|
|
|
13
12
|
for (const buf of input) {
|
package/test/suite.specoff.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Http3EventLoop } from '../lib/event-loop.js'
|
|
2
|
-
|
|
3
|
-
after(async () => {
|
|
4
|
-
if (Http3EventLoop.globalLoop != null) {
|
|
5
|
-
// shut down loop, otherwise we have to wait for
|
|
6
|
-
// it to time out which takes a long time.
|
|
7
|
-
Http3EventLoop.globalLoop.shutdownEventLoop()
|
|
8
|
-
}
|
|
9
|
-
})
|