@ac-kit/integration-test-util 0.2.4 → 0.4.0
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/CHANGELOG.md +72 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tls/create-self-signed-certificate.d.ts +20 -0
- package/dist/tls/create-self-signed-certificate.d.ts.map +1 -0
- package/dist/tls/create-self-signed-certificate.js +54 -0
- package/dist/tls/create-self-signed-certificate.js.map +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
1
1
|
# @ac-kit/integration-test-util
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5075202: HTTP/3, over a multiplexed connection contract.
|
|
8
|
+
|
|
9
|
+
- `net-core`: `IMultiplexedConnection` and `IMultiplexedStream` — a secure
|
|
10
|
+
connection carrying many streams, each a `Transport` that either side can
|
|
11
|
+
reset or stop on its own — with `MultiplexedStreamHandlers` and the errors a
|
|
12
|
+
reset, a stop or the connection's end report. `Connector` is now generic over
|
|
13
|
+
what it establishes, like `IListener`.
|
|
14
|
+
- `async`: `staggeredRace`, RFC 8305 connection racing for any candidates.
|
|
15
|
+
- `format-varint`: QUIC variable-length integers (RFC 9000 §16) —
|
|
16
|
+
`readQuicVarint`, `readBigQuicVarint` (the whole 62-bit range, as a
|
|
17
|
+
`bigint`), `writeQuicVarint`, `encodeQuicVarint`, `quicVarintByteLength` and
|
|
18
|
+
`quicVarintEncodedLength`.
|
|
19
|
+
- `format-http`: `QpackDecoder` (RFC 9204, dynamic table and blocked streams)
|
|
20
|
+
and `QpackEncoder` (static table and literals); `Http3FrameDecoder` and
|
|
21
|
+
`encodeHttp3Frame` for HTTP/3 frames (RFC 9114), with DATA streamed in
|
|
22
|
+
pieces; `Http3Settings`, `Http3StreamType`, `Http3Error` and
|
|
23
|
+
`Http3ErrorCode`. `parseAltSvc` and `tryParseAltSvc` read the `Alt-Svc`
|
|
24
|
+
field (RFC 7838), `AltSvcSyntaxError` reporting a malformed one.
|
|
25
|
+
- `net-http`: `Http3ServerConnection` and `Http3ClientConnection`, with
|
|
26
|
+
trailers, GOAWAY and extended `CONNECT` tunnels (RFC 9220). `HttpServer`
|
|
27
|
+
serves HTTP/3 on multiplexed listeners with its `http3` option; `HttpAgent`
|
|
28
|
+
reaches `https:` origins over HTTP/3 with its own: those advertising it
|
|
29
|
+
through `Alt-Svc`, raced against TCP and falling back to it, or every one
|
|
30
|
+
with `priorKnowledge`.
|
|
31
|
+
- `net-quic`: first release. `QuicListener` and `createQuicConnector` over a
|
|
32
|
+
native quiche binding; the binding of each platform is its own optional
|
|
33
|
+
package, `@ac-kit/net-quic-<platform>`. A client's UDP socket is connected,
|
|
34
|
+
so a refused port fails the attempt at once.
|
|
35
|
+
- `node`: `DgramSocket.connect`, `disconnect`, `remoteAddress` and
|
|
36
|
+
`sendConnected`, for a UDP socket bound to one remote endpoint.
|
|
37
|
+
- `integration-test-util`: `createSelfSignedCertificate` takes the names the
|
|
38
|
+
certificate is valid for.
|
|
39
|
+
- `net-websocket`: documented over HTTP/3, which needed no change.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [5075202]
|
|
44
|
+
- @ac-kit/node@0.5.0
|
|
45
|
+
- @ac-kit/cmd-docker@0.2.3
|
|
46
|
+
|
|
47
|
+
## 0.3.0
|
|
48
|
+
|
|
49
|
+
### Minor Changes
|
|
50
|
+
|
|
51
|
+
- 1af504e: HTTP/2, and TLS with ALPN.
|
|
52
|
+
|
|
53
|
+
- `format-http`: `Http2FrameCodec`, the RFC 9113 frame codec with field blocks
|
|
54
|
+
HPACK-coded on the way, and `HpackEncoder`/`HpackDecoder` (RFC 7541) on their
|
|
55
|
+
own. Sensitive fields are sent never-indexed; an oversized header list is a
|
|
56
|
+
stream error that keeps both ends' tables in step.
|
|
57
|
+
- `net-http`: `Http2ServerConnection` and `Http2ClientConnection` — concurrent
|
|
58
|
+
streams, flow control as backpressure, trailers, `GOAWAY`, a control-frame
|
|
59
|
+
rate guard against rapid-reset floods, and extended `CONNECT` tunnels.
|
|
60
|
+
`HttpServer` serves HTTP/2 through ALPN `h2` and cleartext prior knowledge
|
|
61
|
+
with its `http2` option; `HttpAgent` offers `h2` and multiplexes one
|
|
62
|
+
connection per origin with its own. A request's `protocol` now also works
|
|
63
|
+
over HTTP/1.1, sent as an `Upgrade`.
|
|
64
|
+
- `net-core`: `peekTransport`, to read a connection's first bytes without
|
|
65
|
+
consuming them.
|
|
66
|
+
- `net-transport-node`: TLS in `TcpListener.listen` (`tls` option, ALPN,
|
|
67
|
+
handshake timeout) and in the new `createTcpConnector`; `connectTcp` opens
|
|
68
|
+
`secure` targets with Node's default trust. Concurrent writes waiting for
|
|
69
|
+
`drain` share one listener.
|
|
70
|
+
- `integration-test-util`: `createSelfSignedCertificate`, a throwaway
|
|
71
|
+
certificate for TLS tests.
|
|
72
|
+
- `net-websocket`: `connectWebSocket` over HTTP/2 (RFC 8441), through the same
|
|
73
|
+
version-neutral request.
|
|
74
|
+
|
|
3
75
|
## 0.2.4
|
|
4
76
|
|
|
5
77
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export * from "./docker/init-docker-suite.js";
|
|
|
2
2
|
export * from "./net/is-tcp-port-open.js";
|
|
3
3
|
export * from "./net/try-tcp-connect-n-read-banner.js";
|
|
4
4
|
export * from "./net/try-tls-connect-n-read-banner.js";
|
|
5
|
+
export * from "./tls/create-self-signed-certificate.js";
|
|
5
6
|
//# 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,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from "./docker/init-docker-suite.js";
|
|
|
2
2
|
export * from "./net/is-tcp-port-open.js";
|
|
3
3
|
export * from "./net/try-tcp-connect-n-read-banner.js";
|
|
4
4
|
export * from "./net/try-tls-connect-n-read-banner.js";
|
|
5
|
+
export * from "./tls/create-self-signed-certificate.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A certificate and its private key, PEM-encoded. */
|
|
2
|
+
export type SelfSignedCertificate = {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly cert: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Create a throwaway self-signed certificate for `localhost` and `127.0.0.1`,
|
|
8
|
+
* for a test that needs a TLS server. Trust it explicitly on the client side
|
|
9
|
+
* (`ca: cert`); nothing is installed anywhere.
|
|
10
|
+
*
|
|
11
|
+
* Uses the `openssl` command, which must be on the `PATH`, with an ECDSA P-256
|
|
12
|
+
* key valid for one day. Takes tens of milliseconds: create one per suite.
|
|
13
|
+
*
|
|
14
|
+
* @param subjectAltNames The names the certificate is valid for, in OpenSSL's
|
|
15
|
+
* `subjectAltName` syntax. Defaults to `localhost` and `127.0.0.1`; a test of
|
|
16
|
+
* name verification passes others.
|
|
17
|
+
* @throws When `openssl` is missing or fails.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createSelfSignedCertificate(subjectAltNames?: readonly string[]): Promise<SelfSignedCertificate>;
|
|
20
|
+
//# sourceMappingURL=create-self-signed-certificate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-self-signed-certificate.d.ts","sourceRoot":"","sources":["../../src/tls/create-self-signed-certificate.ts"],"names":[],"mappings":"AAQA,sDAAsD;AACtD,MAAM,MAAM,qBAAqB,GAAG;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,2BAA2B,CAChD,eAAe,GAAE,SAAS,MAAM,EAAsC,GACpE,OAAO,CAAC,qBAAqB,CAAC,CAgChC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
/**
|
|
8
|
+
* Create a throwaway self-signed certificate for `localhost` and `127.0.0.1`,
|
|
9
|
+
* for a test that needs a TLS server. Trust it explicitly on the client side
|
|
10
|
+
* (`ca: cert`); nothing is installed anywhere.
|
|
11
|
+
*
|
|
12
|
+
* Uses the `openssl` command, which must be on the `PATH`, with an ECDSA P-256
|
|
13
|
+
* key valid for one day. Takes tens of milliseconds: create one per suite.
|
|
14
|
+
*
|
|
15
|
+
* @param subjectAltNames The names the certificate is valid for, in OpenSSL's
|
|
16
|
+
* `subjectAltName` syntax. Defaults to `localhost` and `127.0.0.1`; a test of
|
|
17
|
+
* name verification passes others.
|
|
18
|
+
* @throws When `openssl` is missing or fails.
|
|
19
|
+
*/
|
|
20
|
+
export async function createSelfSignedCertificate(subjectAltNames = ["DNS:localhost", "IP:127.0.0.1"]) {
|
|
21
|
+
const directory = await mkdtemp(join(tmpdir(), "ac-kit-tls-"));
|
|
22
|
+
try {
|
|
23
|
+
const keyPath = join(directory, "key.pem");
|
|
24
|
+
const certPath = join(directory, "cert.pem");
|
|
25
|
+
await execFileAsync("openssl", [
|
|
26
|
+
"req",
|
|
27
|
+
"-x509",
|
|
28
|
+
"-newkey",
|
|
29
|
+
"ec",
|
|
30
|
+
"-pkeyopt",
|
|
31
|
+
"ec_paramgen_curve:P-256",
|
|
32
|
+
"-nodes",
|
|
33
|
+
"-days",
|
|
34
|
+
"1",
|
|
35
|
+
"-subj",
|
|
36
|
+
"/CN=localhost",
|
|
37
|
+
"-addext",
|
|
38
|
+
`subjectAltName=${subjectAltNames.join(",")}`,
|
|
39
|
+
"-keyout",
|
|
40
|
+
keyPath,
|
|
41
|
+
"-out",
|
|
42
|
+
certPath,
|
|
43
|
+
]);
|
|
44
|
+
const [key, cert] = await Promise.all([
|
|
45
|
+
readFile(keyPath, "utf8"),
|
|
46
|
+
readFile(certPath, "utf8"),
|
|
47
|
+
]);
|
|
48
|
+
return { key, cert };
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
await rm(directory, { recursive: true, force: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=create-self-signed-certificate.js.map
|
|
@@ -0,0 +1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QAAQ,EAAE,MAAM,CAAC;SAC1B,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/integration-test-util",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Test helpers that drive and probe external services — Docker containers, TCP and TLS banner checks — from a package's integration tests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docker",
|
|
@@ -38,23 +38,23 @@
|
|
|
38
38
|
"prepack": "yarn build"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ac-kit/cmd-docker": "^0.2.
|
|
41
|
+
"@ac-kit/cmd-docker": "^0.2.3",
|
|
42
42
|
"@ac-kit/core": "^0.5.0",
|
|
43
43
|
"@ac-kit/crypto-random": "^0.1.0",
|
|
44
|
-
"@ac-kit/node": "^0.
|
|
44
|
+
"@ac-kit/node": "^0.5.0",
|
|
45
45
|
"type-fest": "^5.8.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@ac-kit/tsconfig": "0.1.0",
|
|
49
49
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
50
50
|
"@ac-kit/vitest-config": "0.1.1",
|
|
51
|
-
"@types/node": "26.6.
|
|
51
|
+
"@types/node": "26.6.6",
|
|
52
52
|
"@typescript/native": "typescript@7.0.2",
|
|
53
|
-
"rimraf": "6.1.
|
|
53
|
+
"rimraf": "6.1.4",
|
|
54
54
|
"typedoc": "0.28.20",
|
|
55
55
|
"typescript": "@typescript/typescript6@6.0.2",
|
|
56
|
-
"vite": "8.3.
|
|
57
|
-
"vitest": "5.0
|
|
56
|
+
"vite": "8.3.6",
|
|
57
|
+
"vitest": "5.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"vitest": ">=4.0.0"
|