@browsercore/contracts 0.2.9 → 0.2.11

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 CHANGED
@@ -5,23 +5,22 @@
5
5
 
6
6
  The canonical interface package for the browsercore stack. Every protocol
7
7
  package, runtime adapter, and consumer depends on these contracts; they
8
- define how components communicate without coupling them to each other. As of
9
- 0.2.5 this is the canonical single definition for `Transport`,
10
- `CryptoProvider`, and `CompressionProvider` (the implementing packages
11
- re-export them), plus the `Platform` service contracts (events, time,
12
- telemetry, network). As of 0.2.6: every `Platform` bundle is **optional**
8
+ define how components communicate without coupling them to each other. This
9
+ package is the canonical single definition for `Transport`,
10
+ `CryptoProvider`, and `CompressionProvider` — `@browsercore/transport` and
11
+ `@browsercore/crypto` re-export them; `@browsercore/compression` declares
12
+ its own structural copy — plus the `Platform` service contracts (events,
13
+ time, telemetry, network). Every `Platform` bundle is **optional**
13
14
  (capabilities are resolved, not faked), `Network.udp` is a **factory**
14
- (`UdpSocketFactory`), `Clock` is **THE** time contract (superseding the five
15
- sibling-local shapes), `TlsHandshakeEngine` is the contracts-level seam that
16
- lets quic drive a TLS handshake without importing `@browsercore/tls`, and the
17
- `ProxyConfig` family / `ProfileId` / `CookieJarConsumer` config types have
18
- their canonical homes here (owning packages alias next wave). As of 0.2.8 the
19
- certificate mirror is canonical too: `CertificateSignatureAlgorithm` (and
20
- `Certificate.selfSigned`) land here, and tls 0.4.19 imports and re-exports
21
- this type from `@browsercore/contracts` (earlier tls versions declared a
22
- structurally identical local union) — one definition, not a second
23
- `Certificate` beside the engine contract.
24
- Deliberately
15
+ (`UdpSocketFactory`), `Clock` is **THE** time contract,
16
+ `TlsHandshakeEngine` is the contracts-level seam that lets quic drive a TLS
17
+ handshake without importing `@browsercore/tls`, and the `ProxyConfig`
18
+ family / `ProfileId` / `CookieJarConsumer` config types have their
19
+ canonical homes here. The certificate mirror is canonical too:
20
+ `CertificateSignatureAlgorithm` (and `Certificate.selfSigned`) live here,
21
+ and `@browsercore/tls` imports and re-exports them from
22
+ `@browsercore/contracts` — one definition, not a second `Certificate`
23
+ beside the engine contract. Deliberately
25
24
  package-local surfaces that remain duplicated (e.g. the full `CookieJar`)
26
25
  are documented as such at each definition.
27
26
 
@@ -65,47 +64,45 @@ transport tls http1 http2 http3 quic fetch crypto compression
65
64
  ```
66
65
 
67
66
  Dependency direction is strictly upward; contracts is the root dependency.
68
- `browsersmith` is the **only** package allowed `node:*` imports; it builds a
69
- `Platform` object that threads runtime capabilities (network, crypto,
70
- compression, events, telemetry, time) down through options.
67
+ Protocol packages import no `node:*` builtins — runtime capabilities arrive
68
+ through the injected `Platform`, which `browsersmith` (the composition root)
69
+ builds and threads (network, crypto, compression, events, telemetry, time,
70
+ trust) down through options.
71
71
 
72
72
  ## What's inside
73
73
 
74
74
  | Module | Purpose | Key exports |
75
75
  |---|---|---|
76
76
  | **Contracts** | Canonical provider interfaces, the single definitions the implementing packages re-export | `CryptoProvider`, `CompressionProvider`, `Transport`, `DatagramTransport`, `UdpSocketFactory`, `CookieJar`, `PacketCallback` |
77
- | **Platform** | The composition root + per-service bundles, **every bundle optional** | `Platform`, `PlatformOptions`, `Network`, `Crypto`, `Compression` |
77
+ | **Platform** | The composition root + per-service bundles, **every bundle optional** | `Platform`, `PlatformOptions`, `Network`, `Crypto`, `Compression`, `Trust` |
78
78
  | **Events** | Structural emitter interface (a method surface, **not** EventTarget-backed) injected via `Platform.events` | `EventProvider`, `TypedEventEmitter<T>` |
79
79
  | **Time** | THE canonical Clock (wall + monotonic + sleep + timers) and the Duration/Scheduler helpers | `Clock`, `TimerHandle`, `Time`, `Duration`, `Scheduler`, `Deadline` |
80
80
  | **TLS Engine** | The quic↔tls handshake seam; protocol packages never import each other | `TlsHandshakeEngine`, `TlsHandshakeContext`, `ClientHelloConfig`, `ServerHello`, `Certificate`, `CertificateSignatureAlgorithm`, `CipherSuite`, `NamedGroup`, `SignatureScheme`, `AeadAlgorithm`, `ProtocolVersion`, `KeyPair`, `TrafficSecrets`, `ApplicationTrafficSecrets`, `HandshakePhase`, `AlertLevel` |
81
- | **Config** | Canonical configuration types (owning packages alias next wave) | `ProxyConfig`, `ProxyScheme`, `ProxyTarget`, `ProxyCredentials`, `CookieJarConsumer` |
81
+ | **TLS Session** | The tls↔browsersmith resumption seam: one ticket record per NewSessionTicket and the string-keyed (SNI) ticket store browsersmith implements and tls consumes; sync by design, `get` never consumes — the caller pops via `delete` | `TlsSessionStore`, `TlsResumptionTicket` |
82
+ | **Config** | Canonical configuration types | `ProxyConfig`, `ProxyScheme`, `ProxyTarget`, `ProxyCredentials`, `CookieJarConsumer` |
82
83
  | **Telemetry** | OTel-aligned observability | `Logger`, `Tracer`, `Span`, `Metrics`, `Telemetry` |
83
84
  | **Models** | Shared data structures that cross package boundaries | `BrowserProfile`, `TlsProfile`, `Http1Profile`, `Http2Profile`, `ProfileId`, `Request`, `Response`, `Headers`, `Cookie`, `TransportState`, `CloseReason`, `ContentEncoding` |
84
85
  | **Net** | Platform-agnostic TCP + DNS contracts for runtime portability (`DnsResolver.lookupAll?` — optional single dual-family lookup) | `Net`, `DnsResolver`, `Socket`, `ConnectOptions`, `IPAddress` |
85
- | **IANA Tables** | Canonical TLS wire code lookup tables (single source of truth) | `CIPHER_SUITE_CODES`, `NAMED_GROUP_CODES`, `SIGNATURE_SCHEME_CODES`, `VERSION_CODES` |
86
+ | **IANA Tables** | Canonical TLS wire code lookup tables (single source of truth) | `CIPHER_SUITE_CODES`, `NAMED_GROUP_CODES`, `SIGNATURE_SCHEME_CODES`, `VERSION_CODES`, `CIPHER_GREASE_PLACEHOLDER` |
86
87
 
87
- The former "Protocol Connection Contracts" (`TlsConnection`, `Http1Connection`,
88
- `Http2Connection`, `Http3Connection`, `QuicConnection`, `QuicStream`,
89
- `FetchClient`) and the Options layer (`TlsOptions` … `FetchClientOptions`) were
90
- removed in 0.2.5. They had zero consumers, since every consumer binds the
91
- implementation-local types exported by the protocol packages themselves
92
- (replaceability audit, 2026-11-16). `Transport` and `CryptoProvider` here are
93
- now the canonical single definitions that `@browsercore/transport` and
94
- `@browsercore/crypto` re-export.
88
+ This package defines no protocol connection contracts (`TlsConnection`,
89
+ `Http1Connection`, `Http2Connection`, `Http3Connection`, `QuicConnection`,
90
+ `QuicStream`, `FetchClient`) and no options layer (`TlsOptions` …
91
+ `FetchClientOptions`): every consumer binds the implementation-local types
92
+ exported by the protocol packages themselves. `Transport` and
93
+ `CryptoProvider` here are the canonical single definitions that
94
+ `@browsercore/transport` and `@browsercore/crypto` re-export.
95
95
 
96
- ## Platform semantics (0.2.6)
96
+ ## Platform semantics
97
97
 
98
98
  **Every `Platform` bundle is optional** (`network?`, `crypto?`,
99
- `compression?`, `events?`, `telemetry?`, `time?`), and every `Network`
99
+ `compression?`, `events?`, `telemetry?`, `time?`, `trust?`), and every `Network`
100
100
  member is optional (`tcp?`, `dns?`, `udp?`). A platform carries exactly the
101
101
  capabilities its runtime has; nothing has to be faked. The contract is:
102
102
 
103
103
  - **Consumers resolve what they use and throw typed errors naming the
104
- missing capability.** `@browsercore/fetch`'s `proxyDialPlatform`
105
- (`fetch/src/proxy.ts`) demonstrated the pattern while the fields were
106
- still required; untouched bundles were throwing getters naming the
107
- culprit. With optional bundles the same guarantee is expressed by
108
- omitting the field, and consumers write
104
+ missing capability.** With optional bundles the guarantee is expressed
105
+ by omitting the field, and consumers write
109
106
  `platform.network?.tcp ?? throw missingCapability("platform.network.tcp")`.
110
107
  - **Implementers may provide everything**: an implementation providing
111
108
  more than a consumer requires (e.g. `browsersmith`'s `createPlatform()`)
@@ -114,49 +111,42 @@ capabilities its runtime has; nothing has to be faked. The contract is:
114
111
 
115
112
  **UDP is a factory, not an instance.** `Network.udp` is a
116
113
  `UdpSocketFactory`: `connect(address)` returns a per-connection
117
- `DatagramTransport`. The previous instance shape (`udp: DatagramTransport`)
118
- forced the composition root to bind one socket at module-import time
119
- (browsersmith's import-time `createSocket("udp4")` singleton,
120
- replaceability audit, 2026-11-16). A factory binds sockets at connection
121
- time, per connection, and lets UDP-less runtimes (Cloudflare Workers) omit
122
- the capability instead of dead-binding a socket.
114
+ `DatagramTransport`. Sockets bind at connection time, per connection, and
115
+ UDP-less runtimes (Cloudflare Workers) omit the capability instead of
116
+ dead-binding a socket.
117
+
118
+ **`trust` carries the runtime's root store.** `Trust.rootStore()` returns
119
+ the DER trust anchors the runtime offers its own TLS stack (Node's bundled
120
+ Mozilla store plus `NODE_EXTRA_CA_CERTS`). It is the runtime's own root
121
+ program, not Chrome's root program; certificate verification policy lives
122
+ in `@browsercore/tls`, which receives the anchors as plain bytes.
123
123
 
124
124
  **`Clock` is THE time contract.** `now()` (wall, epoch ms),
125
125
  `monotonic()` (monotonic ms; never `Date.now()` deltas for deadline math),
126
126
  `sleep(ms)`, `setTimeout(ms, fn)` / `clearTimeout(handle)` with
127
127
  `TimerHandle` an opaque `object` (not `NodeJS.Timeout`; runtime timer
128
- tokens must not leak into published declarations). It supersedes the five
129
- package-local sibling Clock shapes (tls/http1/http2/http3/quic), whose
130
- `options.clock` seams migrate onto it in the next wave. `Time` remains as
131
- the `Platform` bundle name aliasing `Clock`; `Duration`/`Scheduler`/
132
- `Deadline` stay for duration-composed scheduling.
128
+ tokens must not leak into published declarations). `Time` is the
129
+ `Platform` bundle name aliasing `Clock`; `Duration`/`Scheduler`/
130
+ `Deadline` serve duration-composed scheduling.
133
131
 
134
132
  **`TlsHandshakeEngine` is the quic↔tls seam.** Protocol packages never
135
133
  import each other (the no-hard-wires invariant); this interface,
136
134
  `runHandshake` / `generateKeyShares` / `cipherSuiteToAead` plus the pure
137
135
  handshake data types, is what `@browsercore/tls` implements and the
138
- composition root injects into quic, replacing quic's direct tls imports
139
- (the audit's single no-hard-wires violation). http3's fake-quic
140
- compatibility test is the proof-of-concept for swapping a structural engine
141
- implementation.
142
-
143
- **`Certificate.signatureAlgorithm` is a discriminated union (0.2.8,
144
- breaking).** The engine's certificate mirror previously carried
145
- `signatureScheme: SignatureScheme`, and the tls parser threw for every
146
- signature algorithm outside four hardcoded OIDs — making servers presenting
147
- SHA-384/512 RSA, ECDSA-SHA512, Ed25519, or RSA-PSS certificates unreachable.
148
- tls 0.4.19 fixed that by never throwing on a structurally valid certificate:
149
- parsing always succeeds, and `CertificateSignatureAlgorithm` records the
150
- outcome — `{ kind: "supported", scheme }` when the OID maps to a scheme the
136
+ composition root injects into quic.
137
+
138
+ **`Certificate.signatureAlgorithm` is a discriminated union.** Parsing
139
+ never throws on a structurally valid certificate:
140
+ `CertificateSignatureAlgorithm` records the outcome —
141
+ `{ kind: "supported", scheme }` when the OID maps to a scheme the
151
142
  engine can verify, or `{ kind: "rejected", reason: "sha1" | "md5" |
152
143
  "pss-parameters" | "unknown", oid }` naming the policy reason and the
153
144
  dotted-arc OID when policy declines it. Acceptance is the ENGINE's decision,
154
145
  not the parser's — matching Chrome, which parses SHA-1-signed roots but
155
- refuses to rely on them. The mirror also gained `Certificate.selfSigned`
156
- (true when the subject DN bytes equal the issuer DN bytes). This is a
157
- breaking type change for consumers reading `peerCertificate.signatureScheme`:
158
- migrate by switching on `peerCertificate.signatureAlgorithm.kind` —
159
- `"supported"` reads `.scheme` where `signatureScheme` used to be read;
146
+ refuses to rely on them. `Certificate.selfSigned` is true when the subject
147
+ DN bytes equal the issuer DN bytes. Consumers switch on
148
+ `peerCertificate.signatureAlgorithm.kind` —
149
+ `"supported"` reads `.scheme`;
160
150
  `"rejected"` surfaces `.reason`/`.oid` instead of a thrown error:
161
151
 
162
152
  ```ts
@@ -177,8 +167,7 @@ function describeIssuerSignature(certificate: Certificate): string {
177
167
  `ProxyCredentials` (verbatim from `@browsercore/proxy`), `ProfileId` (the
178
168
  ten built-in registry ids), and `CookieJarConsumer` (the minimal jar surface
179
169
  fetch actually calls; `@browsercore/cookies`' full jar satisfies it
180
- structurally) are defined here as canonical; the owning packages alias onto
181
- them in the next wave.
170
+ structurally) are defined here as canonical.
182
171
 
183
172
  Further rationale (why the sync crypto/compression contracts are deliberate,
184
173
  why WebCrypto/CompressionStream are not valid backends, and what an async
@@ -239,7 +228,8 @@ class MyCustomTransport implements Transport {
239
228
  ## Zero overhead
240
229
 
241
230
  All type exports are erased by the TypeScript compiler. The only runtime
242
- exports are the IANA wire code tables and `Duration` factories, plain
231
+ exports are the IANA wire code tables (plus the `CIPHER_GREASE_PLACEHOLDER`
232
+ constant) and the `Duration` factory, plain
243
233
  `const` objects with no dependencies, no side effects.
244
234
 
245
235
  ## Contributing
package/dist/index.d.ts CHANGED
@@ -27,11 +27,12 @@ export type { ProfileId, RegisteredProfileId, BrowserProfile, TlsProfile, Http1P
27
27
  export { CIPHER_GREASE_PLACEHOLDER, CIPHER_SUITE_CODES, NAMED_GROUP_CODES, SIGNATURE_SCHEME_CODES, VERSION_CODES, } from "./models.js";
28
28
  export type { ConnectOptions, Socket, Net, DnsResolver, IPAddress, Network, } from "./tcp-transport.js";
29
29
  export type { AeadAlgorithm, CipherSuite, NamedGroup, SignatureScheme, CertificateSignatureAlgorithm, ProtocolVersion, ClientHelloConfig, ServerHello, Certificate, KeyPair, TrafficSecrets, ApplicationTrafficSecrets, HandshakePhase, AlertLevel, TlsHandshakeContext, TlsHandshakeEngine, } from "./tls-engine.js";
30
+ export type { TlsResumptionTicket, TlsSessionStore, } from "./tls-session.js";
30
31
  export type { ProxyScheme, ProxyConfig, ProxyTarget, ProxyCredentials, CookieJarConsumer, } from "./config.js";
31
32
  export type { EventProvider, TypedEventEmitter, } from "./events.js";
32
33
  export type { Logger, Span, Tracer, Metrics, Telemetry, } from "./telemetry.js";
33
34
  export type { Clock, TimerHandle, Deadline, Scheduler, Time, } from "./time.js";
34
35
  /** Duration static factories — `Duration.seconds(5)`, `Duration.milliseconds(250)`. */
35
36
  export { Duration } from "./time.js";
36
- export type { Compression, Crypto, Platform, PlatformOptions, } from "./platform.js";
37
+ export type { Compression, Crypto, Platform, PlatformOptions, Trust, } from "./platform.js";
37
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,YAAY,EAER,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAEhB,SAAS,EAET,cAAc,EACd,uBAAuB,GAC1B,MAAM,gBAAgB,CAAC;AAMxB,YAAY,EAER,SAAS,EACT,mBAAmB,EAEnB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAElB,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,aAAa,EAEb,OAAO,EAEP,MAAM,EAEN,MAAM,EACN,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EAEX,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,QAAQ,EAER,eAAe,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACH,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GAChB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,cAAc,EACd,MAAM,EACN,GAAG,EACH,WAAW,EACX,SAAS,EACT,OAAO,GACV,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EAER,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EAGf,6BAA6B,EAC7B,eAAe,EAEf,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,OAAO,EACP,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AAMzB,YAAY,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,aAAa,EACb,iBAAiB,GACpB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,SAAS,GACZ,MAAM,gBAAgB,CAAC;AAMxB,YAAY,EACR,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,EACT,IAAI,GACP,MAAM,WAAW,CAAC;AAEnB,uFAAuF;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMrC,YAAY,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,GAClB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,YAAY,EAER,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAEhB,SAAS,EAET,cAAc,EACd,uBAAuB,GAC1B,MAAM,gBAAgB,CAAC;AAMxB,YAAY,EAER,SAAS,EACT,mBAAmB,EAEnB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAElB,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,aAAa,EAEb,OAAO,EAEP,MAAM,EAEN,MAAM,EACN,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EAEX,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,QAAQ,EAER,eAAe,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACH,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GAChB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,cAAc,EACd,MAAM,EACN,GAAG,EACH,WAAW,EACX,SAAS,EACT,OAAO,GACV,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EAER,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EAGf,6BAA6B,EAC7B,eAAe,EAEf,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,OAAO,EACP,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AAMzB,YAAY,EACR,mBAAmB,EACnB,eAAe,GAClB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,aAAa,EACb,iBAAiB,GACpB,MAAM,aAAa,CAAC;AAMrB,YAAY,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,SAAS,GACZ,MAAM,gBAAgB,CAAC;AAMxB,YAAY,EACR,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,EACT,IAAI,GACP,MAAM,WAAW,CAAC;AAEnB,uFAAuF;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMrC,YAAY,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,KAAK,GACR,MAAM,eAAe,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA4DH,8DAA8D;AAC9D,OAAO,EACH,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GAChB,MAAM,aAAa,CAAC;AAwFrB,uFAAuF;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAarC,8EAA8E;AAC9E,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAC7D,qCAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA4DH,8DAA8D;AAC9D,OAAO,EACH,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GAChB,MAAM,aAAa,CAAC;AAiGrB,uFAAuF;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAcrC,8EAA8E;AAC9E,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAC7D,qCAAqC"}
@@ -4,7 +4,7 @@
4
4
  * This is the single object that browsersmith assembles and passes down
5
5
  * to every protocol package. Each field is a service bundle that groups
6
6
  * related platform capabilities (network, crypto, compression, events,
7
- * telemetry, time).
7
+ * telemetry, time, trust).
8
8
  *
9
9
  * Architecture:
10
10
  *
@@ -17,7 +17,8 @@
17
17
  * ├── compression? (gzip, deflate, brotli, etc.)
18
18
  * ├── events? (EventProvider)
19
19
  * ├── telemetry? (logger, tracer, metrics)
20
- * └── time? (Clock — the canonical time contract)
20
+ * ├── time? (Clock — the canonical time contract)
21
+ * └── trust? (Trust — the runtime trust root store)
21
22
  *
22
23
  * All fields are interfaces — this file has zero runtime behavior
23
24
  * and zero node:* imports.
@@ -48,6 +49,22 @@ export type Compression = CompressionProvider;
48
49
  export interface Crypto {
49
50
  readonly provider: CryptoProvider;
50
51
  }
52
+ /**
53
+ * `Trust` — the injected runtime trust root store (part of `Platform`).
54
+ *
55
+ * Runtime trust anchors — the store THIS runtime offers its own TLS stack.
56
+ *
57
+ * This is the runtime's own root program (e.g. Node's bundled Mozilla store
58
+ * plus `NODE_EXTRA_CA_CERTS`), not Chrome's root program; certificate
59
+ * verification policy lives in `@browsercore/tls`, which receives the
60
+ * anchors as plain DER bytes. `browsersmith` populates this bundle from its
61
+ * Node adapter; protocol packages reach it through options, never by
62
+ * importing `node:tls` directly.
63
+ */
64
+ export interface Trust {
65
+ /** Raw DER root certificates (e.g. Node's bundled Mozilla store + NODE_EXTRA_CA_CERTS). */
66
+ readonly rootStore: () => readonly Uint8Array[];
67
+ }
51
68
  /**
52
69
  * `Platform` — the single composition root for all runtime services.
53
70
  *
@@ -82,6 +99,8 @@ export interface Platform {
82
99
  readonly events?: EventProvider;
83
100
  readonly telemetry?: Telemetry;
84
101
  readonly time?: Time;
102
+ /** Trust bundle — the runtime trust root store; see {@link Trust}. */
103
+ readonly trust?: Trust;
85
104
  }
86
105
  /**
87
106
  * Options for overriding individual platform adapters.
@@ -102,5 +121,8 @@ export interface PlatformOptions {
102
121
  readonly events?: EventProvider;
103
122
  readonly telemetry?: Telemetry;
104
123
  readonly time?: Time;
124
+ readonly trust?: {
125
+ readonly rootStore?: () => readonly Uint8Array[];
126
+ };
105
127
  }
106
128
  //# sourceMappingURL=platform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMtC;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAM9C;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACnB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACrC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,QAAQ;IACrB,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACxB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE;QACf,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;QACnB,QAAQ,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC;QAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC;KACnC,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE;QACd,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;KACtC,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACxB"}
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMtC;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAM9C;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACnB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACrC;AAMD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,KAAK;IAClB,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,EAAE,MAAM,SAAS,UAAU,EAAE,CAAC;CACnD;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,QAAQ;IACrB,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CAC1B;AAMD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE;QACf,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;QACnB,QAAQ,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC;QAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC;KACnC,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE;QACd,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;KACtC,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE;QACb,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,SAAS,UAAU,EAAE,CAAC;KACpD,CAAC;CACL"}
package/dist/platform.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * This is the single object that browsersmith assembles and passes down
5
5
  * to every protocol package. Each field is a service bundle that groups
6
6
  * related platform capabilities (network, crypto, compression, events,
7
- * telemetry, time).
7
+ * telemetry, time, trust).
8
8
  *
9
9
  * Architecture:
10
10
  *
@@ -17,7 +17,8 @@
17
17
  * ├── compression? (gzip, deflate, brotli, etc.)
18
18
  * ├── events? (EventProvider)
19
19
  * ├── telemetry? (logger, tracer, metrics)
20
- * └── time? (Clock — the canonical time contract)
20
+ * ├── time? (Clock — the canonical time contract)
21
+ * └── trust? (Trust — the runtime trust root store)
21
22
  *
22
23
  * All fields are interfaces — this file has zero runtime behavior
23
24
  * and zero node:* imports.
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * TLS session-resumption contracts — the ticket record and the ticket
3
+ * store seam between `@browsercore/tls` (consumer) and browsersmith
4
+ * (implementer).
5
+ *
6
+ * Why this module exists: PSK-based TLS 1.3 session resumption needs a
7
+ * ticket store whose lifecycle crosses a package boundary. `@browsercore/tls`
8
+ * consumes the store — it offers a valid stored ticket as the single PSK
9
+ * identity (Chrome 140 wire rules) and writes every received
10
+ * NewSessionTicket back — while browsersmith, the composition root, owns
11
+ * the concrete store, the opt-in flag, and the default-off policy. Both
12
+ * sides import these definitions from here (canonical-type rule,
13
+ * code-standards §22; litmus test: "Could another package reasonably
14
+ * import this type?"), so neither re-declares the shape and the two
15
+ * sides cannot drift. This is the same seam pattern as
16
+ * {@link ./tls-engine.js~TlsHandshakeEngine}: the implementing package
17
+ * satisfies the interface, the consuming package depends on it, the
18
+ * composition root injects it.
19
+ *
20
+ * Decisions this contract bakes in:
21
+ *
22
+ * - **The store key is the SNI serverName string.** That is all the TLS
23
+ * engine knows — the transport arrives already connected, carrying no
24
+ * proxy or privacy context. Chrome additionally partitions its cache by
25
+ * privacy mode, proxy chain, and network anonymization key
26
+ * (net:ssl_client_session_cache.h:44-62); a caller needing those
27
+ * partitions encodes them into its own key strings. The interface stays
28
+ * a plain `string`-keyed map.
29
+ * - **Synchronous by design.** The store is consulted at ClientHello
30
+ * build time, inside the handshake, and Chrome's cache lookup is
31
+ * synchronous too (net:ssl_client_session_cache.cc `Lookup`). An async
32
+ * interface would force every handshake to await before it can offer,
33
+ * for no benefit: the shipped store is an in-memory Map, and a
34
+ * persistent store can warm its in-memory mirror so lookups stay sync.
35
+ * - **Single-use pop lives in the caller, not the store.** Every TLS 1.3
36
+ * session is single-use (bssl:ssl_session.cc:955-957); Chrome removes
37
+ * the ticket atomically inside its cache at offer time, before the
38
+ * handshake outcome is known (`Entry::Pop`,
39
+ * net:ssl_client_session_cache.cc:151-160). This contract splits the
40
+ * read from the pop: `get` is side-effect-free so a caller can inspect
41
+ * the store without consuming — that inspectability, not Chrome parity
42
+ * (Chrome's Lookup pops), is the reason get is side-effect-free — and
43
+ * consumption is the explicit {@link TlsSessionStore.delete}, which
44
+ * carries the same-turn duty the split imposes (see `delete`).
45
+ *
46
+ * Pure data and signatures — no runtime, no node:* (design rule 2).
47
+ * `CipherSuite` is imported from `./tls-engine.js` for the ticket's
48
+ * PRF-hash guard; it stays exported from there, not re-exported here.
49
+ */
50
+ import type { CipherSuite } from "./tls-engine.js";
51
+ /**
52
+ * `TlsSessionStore` — the cross-connection resumption ticket store.
53
+ *
54
+ * Browsersmith implements this (the shipped shape is an in-memory,
55
+ * Chrome-like LRU cache) and the TLS engine consumes it: when a store is
56
+ * present the engine offers a valid stored ticket as the single PSK
57
+ * identity and writes received NewSessionTickets back; with no store the
58
+ * ClientHello stays byte-identical to a non-resuming client. Exactly one
59
+ * ticket lives per key (newest wins) — TLS 1.3 tickets are single-use,
60
+ * so deeper per-key queues buy nothing; the engine pops at offer time
61
+ * and fresh tickets repopulate after each handshake. Keys are opaque to
62
+ * the contract: the engine keys by SNI serverName (see the module
63
+ * header for why, and for how richer partitions compose into the key).
64
+ */
65
+ export interface TlsSessionStore {
66
+ /**
67
+ * Newest outstanding ticket for `key`, or undefined. NOT consumed by
68
+ * get — consumption is the explicit {@link TlsSessionStore.delete}
69
+ * below, so a caller can inspect the store without side effects. A
70
+ * caller that offers the ticket runs get and delete back-to-back in
71
+ * the same synchronous turn (see delete for why that pairing is on
72
+ * the caller).
73
+ */
74
+ get(key: string): TlsResumptionTicket | undefined;
75
+ /**
76
+ * Store/replaces the ticket for `key` (newest wins). The engine calls
77
+ * this for every NewSessionTicket the server sends post-handshake.
78
+ */
79
+ set(key: string, ticket: TlsResumptionTicket): void;
80
+ /**
81
+ * Remove the ticket for `key` (no-op if absent) — the offer-time pop.
82
+ * The engine deletes when it hands a ticket out, before the handshake
83
+ * outcome is known. The pop enforces single use only when delete runs
84
+ * back-to-back with the get that read the ticket, in the same
85
+ * synchronous turn: nothing in this interface pairs the two calls,
86
+ * so an `await` between them lets a second connection read the same
87
+ * single-use ticket and offer it twice (Chrome stays correct by
88
+ * popping inside its lookup — `Entry::Pop`,
89
+ * net:ssl_client_session_cache.cc:151-160).
90
+ */
91
+ delete(key: string): void;
92
+ }
93
+ /**
94
+ * `TlsResumptionTicket` — one TLS 1.3 NewSessionTicket, canonicalized as
95
+ * the record the store keeps and the engine resumes from. The canonical
96
+ * home of the shape `@browsercore/tls` declares locally as
97
+ * `ResumptionTicket` (tls aliases the contracts type and keeps its old
98
+ * name as a deprecated alias — the same rename-free adoption contracts
99
+ * performed for `CertificateSignatureAlgorithm`), with the server's
100
+ * lifetime hint added. Its fields are exactly the wire record's
101
+ * resumption-relevant data (RFC 8446 §4.2.11/§4.6.1/§7.5). Deliberately
102
+ * absent: the ticket nonce (consumed at PSK-derivation time
103
+ * `HKDF-Expand-Label(resumption_master_secret, "resumption", nonce, …)`,
104
+ * never retained), the ALPN (freely renegotiated on a resumed connection
105
+ * without early data, so resumption must not pin it), and the server
106
+ * name (it is the store key, not a property of the record).
107
+ */
108
+ export interface TlsResumptionTicket {
109
+ /**
110
+ * The opaque ticket identity bytes from the NewSessionTicket message.
111
+ * The client echoes them verbatim as the single PSK identity when it
112
+ * offers resumption (RFC 8446 §4.2.11) — opaque to the client, they
113
+ * are the server's sole lookup key.
114
+ */
115
+ readonly ticket: Uint8Array;
116
+ /**
117
+ * The resumption pre-shared secret, derived as
118
+ * `HKDF-Expand-Label(resumption_master_secret, "resumption",
119
+ * ticket_nonce, Hash.length)` (RFC 8446 §7.5). The binder computation
120
+ * and the PSK key schedule consume it; it never crosses the wire.
121
+ * The record carries a live bearer secret: treat the whole record as
122
+ * sensitive — it is never logged, serialized, or persisted outside
123
+ * process memory.
124
+ */
125
+ readonly psk: Uint8Array;
126
+ /**
127
+ * The server's u32 age-obfuscation addend from the NewSessionTicket.
128
+ * `obfuscated_ticket_age = (now - receivedAt) + ticketAgeAdd` (mod
129
+ * 2^32) is what the client places in the PSK identity, hiding the
130
+ * ticket's true age from observers (RFC 8446 §4.2.11).
131
+ */
132
+ readonly ticketAgeAdd: number;
133
+ /**
134
+ * The cipher suite of the handshake that issued the ticket. The PSK
135
+ * derives from this suite's hash, so resumption is offered only while
136
+ * the offered suite's PRF hash matches it — the guard that drops the
137
+ * PSK from the second ClientHello when a HelloRetryRequest selects a
138
+ * different hash (bssl:extensions.cc:1883-1889).
139
+ */
140
+ readonly cipherSuite: CipherSuite;
141
+ /**
142
+ * Epoch milliseconds at which the client received the ticket,
143
+ * stamped by the producer from its injected wall clock
144
+ * (code-standards §22), never from a bare `Date.now()`. Age and
145
+ * expiry math (`receivedAt + lifetime`) anchor on this value, and
146
+ * the one-second future wiggle (a back-dated ticket is rejected) is
147
+ * measured against it (net:ssl_client_session_cache.cc:126-137).
148
+ */
149
+ readonly receivedAt: number;
150
+ /**
151
+ * Server-advertised ticket lifetime in seconds, from the
152
+ * NewSessionTicket's mandatory `lifetime` field (RFC 8446 §4.6.1);
153
+ * `0` means the ticket never resumes. The field is optional here as
154
+ * a type-move only — records written by `@browsercore/tls` under its
155
+ * pre-contracts `ResumptionTicket` alias predate this field — not
156
+ * because the wire allows omission: consumers treat undefined as no
157
+ * server hint and apply their own default window (2 days, Chrome's
158
+ * `session_psk_dhe_timeout`).
159
+ */
160
+ readonly lifetimeSeconds?: number;
161
+ /**
162
+ * The `max_early_data_size` in bytes that the ticket's `early_data`
163
+ * extension advertised, 0 when absent. Informational only — the
164
+ * client never offers 0-RTT — so this records the server's ceiling
165
+ * without the client ever using it.
166
+ */
167
+ readonly maxEarlyDataSize: number;
168
+ }
169
+ //# sourceMappingURL=tls-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-session.d.ts","sourceRoot":"","sources":["../src/tls-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOnD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IAElD;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEpD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAMD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;OASG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACrC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * TLS session-resumption contracts — the ticket record and the ticket
3
+ * store seam between `@browsercore/tls` (consumer) and browsersmith
4
+ * (implementer).
5
+ *
6
+ * Why this module exists: PSK-based TLS 1.3 session resumption needs a
7
+ * ticket store whose lifecycle crosses a package boundary. `@browsercore/tls`
8
+ * consumes the store — it offers a valid stored ticket as the single PSK
9
+ * identity (Chrome 140 wire rules) and writes every received
10
+ * NewSessionTicket back — while browsersmith, the composition root, owns
11
+ * the concrete store, the opt-in flag, and the default-off policy. Both
12
+ * sides import these definitions from here (canonical-type rule,
13
+ * code-standards §22; litmus test: "Could another package reasonably
14
+ * import this type?"), so neither re-declares the shape and the two
15
+ * sides cannot drift. This is the same seam pattern as
16
+ * {@link ./tls-engine.js~TlsHandshakeEngine}: the implementing package
17
+ * satisfies the interface, the consuming package depends on it, the
18
+ * composition root injects it.
19
+ *
20
+ * Decisions this contract bakes in:
21
+ *
22
+ * - **The store key is the SNI serverName string.** That is all the TLS
23
+ * engine knows — the transport arrives already connected, carrying no
24
+ * proxy or privacy context. Chrome additionally partitions its cache by
25
+ * privacy mode, proxy chain, and network anonymization key
26
+ * (net:ssl_client_session_cache.h:44-62); a caller needing those
27
+ * partitions encodes them into its own key strings. The interface stays
28
+ * a plain `string`-keyed map.
29
+ * - **Synchronous by design.** The store is consulted at ClientHello
30
+ * build time, inside the handshake, and Chrome's cache lookup is
31
+ * synchronous too (net:ssl_client_session_cache.cc `Lookup`). An async
32
+ * interface would force every handshake to await before it can offer,
33
+ * for no benefit: the shipped store is an in-memory Map, and a
34
+ * persistent store can warm its in-memory mirror so lookups stay sync.
35
+ * - **Single-use pop lives in the caller, not the store.** Every TLS 1.3
36
+ * session is single-use (bssl:ssl_session.cc:955-957); Chrome removes
37
+ * the ticket atomically inside its cache at offer time, before the
38
+ * handshake outcome is known (`Entry::Pop`,
39
+ * net:ssl_client_session_cache.cc:151-160). This contract splits the
40
+ * read from the pop: `get` is side-effect-free so a caller can inspect
41
+ * the store without consuming — that inspectability, not Chrome parity
42
+ * (Chrome's Lookup pops), is the reason get is side-effect-free — and
43
+ * consumption is the explicit {@link TlsSessionStore.delete}, which
44
+ * carries the same-turn duty the split imposes (see `delete`).
45
+ *
46
+ * Pure data and signatures — no runtime, no node:* (design rule 2).
47
+ * `CipherSuite` is imported from `./tls-engine.js` for the ticket's
48
+ * PRF-hash guard; it stays exported from there, not re-exported here.
49
+ */
50
+ export {};
51
+ //# sourceMappingURL=tls-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tls-session.js","sourceRoot":"","sources":["../src/tls-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsercore/contracts",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Shared interfaces and models for the browsercore stack",
5
5
  "repository": {
6
6
  "type": "git",