@browsercore/quic 0.2.7 → 0.2.8
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 +22 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@browsercore/quic)
|
|
5
|
-
[](https://jverneuer.github.io/browsercore-quic/COVERAGE.md)
|
|
6
5
|
[](https://github.com/jverneuer/browsercore-quic/actions/workflows/ci.yml)
|
|
7
|
-
[](LICENSE)
|
|
8
6
|
|
|
9
|
-
QUIC transport (RFC 9000)
|
|
7
|
+
QUIC transport (RFC 9000): packet headers, frames, packet protection, streams,
|
|
10
8
|
and connection lifecycle over a datagram (UDP) transport.
|
|
11
9
|
|
|
12
10
|
## Responsibility
|
|
@@ -14,13 +12,13 @@ and connection lifecycle over a datagram (UDP) transport.
|
|
|
14
12
|
Packet header parse/serialization (long + short headers), the full QUIC frame
|
|
15
13
|
set (RFC 9000 §12), variable-length integer encoding (RFC 9000 §16), per-stream
|
|
16
14
|
state machines, receive reassembly, and flow control (connection + stream
|
|
17
|
-
level). The package knows nothing about HTTP/3, TLS, or sockets
|
|
15
|
+
level). The package knows nothing about HTTP/3, TLS, or sockets. It composes
|
|
18
16
|
exclusively over an injected `DatagramTransport` and `@browsercore/crypto`.
|
|
19
17
|
|
|
20
18
|
## What it does NOT know about
|
|
21
19
|
|
|
22
20
|
- HTTP/3, QPACK, or any application protocol
|
|
23
|
-
- TLS 1.3 handshake internals
|
|
21
|
+
- TLS 1.3 handshake internals: the handshake runs through an injected
|
|
24
22
|
`TlsHandshakeEngine` (see below); quic never imports a protocol package
|
|
25
23
|
directly (key derivation lives in `@browsercore/crypto`)
|
|
26
24
|
- UDP, DNS, or sockets
|
|
@@ -29,7 +27,7 @@ exclusively over an injected `DatagramTransport` and `@browsercore/crypto`.
|
|
|
29
27
|
Higher layers compose exclusively through the `QuicConnection` interface. A
|
|
30
28
|
future `@browsercore/http3` opens bidirectional + unidirectional QUIC streams
|
|
31
29
|
and never touches QUIC internals. The production UDP transport **never** calls
|
|
32
|
-
`node:dgram` directly
|
|
30
|
+
`node:dgram` directly. It implements `DatagramTransport`, so the backend is
|
|
33
31
|
replaceable (a test double, a `node:dgram` adapter, a mock).
|
|
34
32
|
|
|
35
33
|
## Public API
|
|
@@ -99,16 +97,16 @@ DatagramTransport (injected UDP)
|
|
|
99
97
|
│
|
|
100
98
|
▼
|
|
101
99
|
┌─────────────────────────────────────────────┐
|
|
102
|
-
│ connection.ts
|
|
103
|
-
│ packet.ts
|
|
104
|
-
│ frame.ts
|
|
105
|
-
│ varint.ts
|
|
100
|
+
│ connection.ts : read loop, packet I/O │
|
|
101
|
+
│ packet.ts : header parse/serialize │
|
|
102
|
+
│ frame.ts : frame parse/serialize │
|
|
103
|
+
│ varint.ts : QUIC varint (RFC 9000 §16) │
|
|
106
104
|
└──────────────┬──────────────────────────────┘
|
|
107
105
|
│ dispatch
|
|
108
106
|
▼
|
|
109
107
|
┌─────────────────────────────────────────────┐
|
|
110
|
-
│ stream.ts
|
|
111
|
-
│ reassembly, flow control
|
|
108
|
+
│ stream.ts : stream state machine, │
|
|
109
|
+
│ reassembly, flow control │
|
|
112
110
|
└─────────────────────────────────────────────┘
|
|
113
111
|
```
|
|
114
112
|
|
|
@@ -127,7 +125,7 @@ composition root:
|
|
|
127
125
|
| --- | --- |
|
|
128
126
|
| `crypto` | `platform.crypto.provider` |
|
|
129
127
|
| `events` | `platform.events` |
|
|
130
|
-
| `clock` | `platform.time` (a `Clock` itself
|
|
128
|
+
| `clock` | `platform.time` (a `Clock` itself; `Time` ≡ `Clock` since contracts 0.2.6) |
|
|
131
129
|
|
|
132
130
|
Individual fields always take precedence, so existing callers that pass
|
|
133
131
|
`crypto`/`events`/`clock` directly keep working unchanged. This is the migration path
|
|
@@ -140,14 +138,14 @@ protocol package. See `@browsercore/contracts` for the `Platform` interface.
|
|
|
140
138
|
Per the no-hard-wires invariant ("protocol packages must never import each
|
|
141
139
|
other directly; all inter-package communication flows through Platform
|
|
142
140
|
interfaces in `@browsercore/contracts`"), quic drives the TLS 1.3 handshake
|
|
143
|
-
(RFC 9001 §4) through the contracts `TlsHandshakeEngine` interface
|
|
144
|
-
`runHandshake` / `generateKeyShares` / `cipherSuiteToAead
|
|
141
|
+
(RFC 9001 §4) through the contracts `TlsHandshakeEngine` interface,
|
|
142
|
+
`runHandshake` / `generateKeyShares` / `cipherSuiteToAead`, never through a
|
|
145
143
|
direct dependency on `@browsercore/tls`. Every type crossing the seam
|
|
146
144
|
(`TlsHandshakeContext`, `ClientHelloConfig`, `ServerHello`, `TrafficSecrets`,
|
|
147
145
|
`CipherSuite`, …) comes from `@browsercore/contracts` as well.
|
|
148
146
|
|
|
149
147
|
**Composition-root wiring** (the pattern every `browsersmith` 0.0.19+ caller
|
|
150
|
-
uses): the root imports the concrete engine once and injects it
|
|
148
|
+
uses): the root imports the concrete engine once and injects it, and quic only
|
|
151
149
|
ever sees the interface.
|
|
152
150
|
|
|
153
151
|
```ts
|
|
@@ -160,7 +158,7 @@ const conn = await connectQuic({
|
|
|
160
158
|
});
|
|
161
159
|
```
|
|
162
160
|
|
|
163
|
-
**Deprecation note
|
|
161
|
+
**Deprecation note: the dynamic default.** When `handshakeEngine` is omitted,
|
|
164
162
|
the handshake falls back to ONE dynamic `import("@browsercore/tls")` wrapping
|
|
165
163
|
the package's three exported functions into the engine object
|
|
166
164
|
(`loadDefaultHandshakeEngine` in `src/handshake/quic-handshake.ts`). That
|
|
@@ -171,14 +169,14 @@ explicitly. Engine internals are never reached.
|
|
|
171
169
|
**Canonical Clock.** `QuicOptions.clock` and `platform.time` are the canonical
|
|
172
170
|
`Clock` from `@browsercore/contracts` (`now` / `monotonic` / `sleep` /
|
|
173
171
|
`setTimeout` / `clearTimeout`). The handshake's certificate-validity time is
|
|
174
|
-
read from the resolved clock
|
|
172
|
+
read from the resolved clock (`Math.floor(clock.now() / 1000)`), never from
|
|
175
173
|
`Date.now()` directly, so cert-time behavior is deterministic under an
|
|
176
174
|
injected fake clock.
|
|
177
175
|
|
|
178
176
|
**Testing with a fake engine.** The sanctioned swap pattern (the same
|
|
179
177
|
structural-implementation approach as http3's `fake-quic` compatibility test)
|
|
180
178
|
is a local fake `TlsHandshakeEngine` that mutates the handshake context the
|
|
181
|
-
way a completed handshake would
|
|
179
|
+
way a completed handshake would. See
|
|
182
180
|
`tests/handshake-engine-injection.test.ts`, which drives a full `connectQuic`
|
|
183
181
|
handshake with the engine injected and asserts the deprecated dynamic
|
|
184
182
|
`@browsercore/tls` fallback import is never taken.
|
|
@@ -192,4 +190,8 @@ handshake with the engine injected and asserts the deprecated dynamic
|
|
|
192
190
|
|
|
193
191
|
## Contributing
|
|
194
192
|
|
|
195
|
-
Contributions are welcome
|
|
193
|
+
Contributions are welcome: bug reports, reproductions, docs and code alike. Start with [CONTRIBUTING.md](CONTRIBUTING.md); the full guide lives in the [browsersmith repo](https://github.com/jverneuer/browsersmith/blob/main/CONTRIBUTING.md). First timer? Check the [`good first issue`](https://github.com/jverneuer/browsercore-quic/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label. Security issues: [SECURITY.md](SECURITY.md), never a public issue.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browsercore/quic",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "QUIC transport (RFC 9000) — packet headers, frames, packet protection, streams, and connection lifecycle over a datagram (UDP) transport. No knowledge of HTTP/3 or TLS handshake semantics.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"clean": "rm -rf dist *.tsbuildinfo",
|
|
30
30
|
"build": "tsc -p tsconfig.json",
|
|
31
31
|
"prepublishOnly": "npm run clean && npm run build",
|
|
32
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
33
33
|
"lint": "oxlint --type-aware src/",
|
|
34
34
|
"test": "vitest run"
|
|
35
35
|
},
|