@browsercore/contracts 0.2.10 → 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 +58 -69
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +24 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +3 -2
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
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.
|
|
9
|
-
|
|
10
|
-
`CryptoProvider`, and `CompressionProvider`
|
|
11
|
-
re-export them
|
|
12
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,48 +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
|
-
|
|
69
|
-
|
|
70
|
-
compression, events, telemetry, time
|
|
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
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
|
|
82
|
+
| **Config** | Canonical configuration types | `ProxyConfig`, `ProxyScheme`, `ProxyTarget`, `ProxyCredentials`, `CookieJarConsumer` |
|
|
83
83
|
| **Telemetry** | OTel-aligned observability | `Logger`, `Tracer`, `Span`, `Metrics`, `Telemetry` |
|
|
84
84
|
| **Models** | Shared data structures that cross package boundaries | `BrowserProfile`, `TlsProfile`, `Http1Profile`, `Http2Profile`, `ProfileId`, `Request`, `Response`, `Headers`, `Cookie`, `TransportState`, `CloseReason`, `ContentEncoding` |
|
|
85
85
|
| **Net** | Platform-agnostic TCP + DNS contracts for runtime portability (`DnsResolver.lookupAll?` — optional single dual-family lookup) | `Net`, `DnsResolver`, `Socket`, `ConnectOptions`, `IPAddress` |
|
|
86
|
-
| **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` |
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
`Http2Connection`, `Http3Connection`, `QuicConnection`,
|
|
90
|
-
`FetchClient`) and
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`@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.
|
|
96
95
|
|
|
97
|
-
## Platform semantics
|
|
96
|
+
## Platform semantics
|
|
98
97
|
|
|
99
98
|
**Every `Platform` bundle is optional** (`network?`, `crypto?`,
|
|
100
|
-
`compression?`, `events?`, `telemetry?`, `time?`), and every `Network`
|
|
99
|
+
`compression?`, `events?`, `telemetry?`, `time?`, `trust?`), and every `Network`
|
|
101
100
|
member is optional (`tcp?`, `dns?`, `udp?`). A platform carries exactly the
|
|
102
101
|
capabilities its runtime has; nothing has to be faked. The contract is:
|
|
103
102
|
|
|
104
103
|
- **Consumers resolve what they use and throw typed errors naming the
|
|
105
|
-
missing capability.**
|
|
106
|
-
|
|
107
|
-
still required; untouched bundles were throwing getters naming the
|
|
108
|
-
culprit. With optional bundles the same guarantee is expressed by
|
|
109
|
-
omitting the field, and consumers write
|
|
104
|
+
missing capability.** With optional bundles the guarantee is expressed
|
|
105
|
+
by omitting the field, and consumers write
|
|
110
106
|
`platform.network?.tcp ?? throw missingCapability("platform.network.tcp")`.
|
|
111
107
|
- **Implementers may provide everything**: an implementation providing
|
|
112
108
|
more than a consumer requires (e.g. `browsersmith`'s `createPlatform()`)
|
|
@@ -115,49 +111,42 @@ capabilities its runtime has; nothing has to be faked. The contract is:
|
|
|
115
111
|
|
|
116
112
|
**UDP is a factory, not an instance.** `Network.udp` is a
|
|
117
113
|
`UdpSocketFactory`: `connect(address)` returns a per-connection
|
|
118
|
-
`DatagramTransport`.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
the
|
|
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.
|
|
124
123
|
|
|
125
124
|
**`Clock` is THE time contract.** `now()` (wall, epoch ms),
|
|
126
125
|
`monotonic()` (monotonic ms; never `Date.now()` deltas for deadline math),
|
|
127
126
|
`sleep(ms)`, `setTimeout(ms, fn)` / `clearTimeout(handle)` with
|
|
128
127
|
`TimerHandle` an opaque `object` (not `NodeJS.Timeout`; runtime timer
|
|
129
|
-
tokens must not leak into published declarations).
|
|
130
|
-
|
|
131
|
-
`
|
|
132
|
-
the `Platform` bundle name aliasing `Clock`; `Duration`/`Scheduler`/
|
|
133
|
-
`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.
|
|
134
131
|
|
|
135
132
|
**`TlsHandshakeEngine` is the quic↔tls seam.** Protocol packages never
|
|
136
133
|
import each other (the no-hard-wires invariant); this interface,
|
|
137
134
|
`runHandshake` / `generateKeyShares` / `cipherSuiteToAead` plus the pure
|
|
138
135
|
handshake data types, is what `@browsercore/tls` implements and the
|
|
139
|
-
composition root injects into quic
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
breaking).** The engine's certificate mirror previously carried
|
|
146
|
-
`signatureScheme: SignatureScheme`, and the tls parser threw for every
|
|
147
|
-
signature algorithm outside four hardcoded OIDs — making servers presenting
|
|
148
|
-
SHA-384/512 RSA, ECDSA-SHA512, Ed25519, or RSA-PSS certificates unreachable.
|
|
149
|
-
tls 0.4.19 fixed that by never throwing on a structurally valid certificate:
|
|
150
|
-
parsing always succeeds, and `CertificateSignatureAlgorithm` records the
|
|
151
|
-
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
|
|
152
142
|
engine can verify, or `{ kind: "rejected", reason: "sha1" | "md5" |
|
|
153
143
|
"pss-parameters" | "unknown", oid }` naming the policy reason and the
|
|
154
144
|
dotted-arc OID when policy declines it. Acceptance is the ENGINE's decision,
|
|
155
145
|
not the parser's — matching Chrome, which parses SHA-1-signed roots but
|
|
156
|
-
refuses to rely on them.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
`"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`;
|
|
161
150
|
`"rejected"` surfaces `.reason`/`.oid` instead of a thrown error:
|
|
162
151
|
|
|
163
152
|
```ts
|
|
@@ -178,8 +167,7 @@ function describeIssuerSignature(certificate: Certificate): string {
|
|
|
178
167
|
`ProxyCredentials` (verbatim from `@browsercore/proxy`), `ProfileId` (the
|
|
179
168
|
ten built-in registry ids), and `CookieJarConsumer` (the minimal jar surface
|
|
180
169
|
fetch actually calls; `@browsercore/cookies`' full jar satisfies it
|
|
181
|
-
structurally) are defined here as canonical
|
|
182
|
-
them in the next wave.
|
|
170
|
+
structurally) are defined here as canonical.
|
|
183
171
|
|
|
184
172
|
Further rationale (why the sync crypto/compression contracts are deliberate,
|
|
185
173
|
why WebCrypto/CompressionStream are not valid backends, and what an async
|
|
@@ -240,7 +228,8 @@ class MyCustomTransport implements Transport {
|
|
|
240
228
|
## Zero overhead
|
|
241
229
|
|
|
242
230
|
All type exports are erased by the TypeScript compiler. The only runtime
|
|
243
|
-
exports are the IANA wire code tables
|
|
231
|
+
exports are the IANA wire code tables (plus the `CIPHER_GREASE_PLACEHOLDER`
|
|
232
|
+
constant) and the `Duration` factory, plain
|
|
244
233
|
`const` objects with no dependencies, no side effects.
|
|
245
234
|
|
|
246
235
|
## Contributing
|
package/dist/index.d.ts
CHANGED
|
@@ -34,5 +34,5 @@ export type { Logger, Span, Tracer, Metrics, Telemetry, } from "./telemetry.js";
|
|
|
34
34
|
export type { Clock, TimerHandle, Deadline, Scheduler, Time, } from "./time.js";
|
|
35
35
|
/** Duration static factories — `Duration.seconds(5)`, `Duration.milliseconds(250)`. */
|
|
36
36
|
export { Duration } from "./time.js";
|
|
37
|
-
export type { Compression, Crypto, Platform, PlatformOptions, } from "./platform.js";
|
|
37
|
+
export type { Compression, Crypto, Platform, PlatformOptions, Trust, } from "./platform.js";
|
|
38
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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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AE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMrC,YAAY,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,
|
|
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;AAiGrB,uFAAuF;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
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"}
|
package/dist/platform.d.ts
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
|
-
*
|
|
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
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA
|
|
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,CAA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,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
|
-
*
|
|
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.
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}
|