@harperfast/integration-testing 0.4.0 → 0.5.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/README.md +20 -5
- package/package.json +4 -3
- package/dist/harperLifecycle.d.ts +0 -182
- package/dist/harperLifecycle.js +0 -374
- package/dist/harperLifecycle.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/loopbackAddressPool.d.ts +0 -50
- package/dist/loopbackAddressPool.js +0 -337
- package/dist/loopbackAddressPool.js.map +0 -1
- package/dist/run.d.ts +0 -2
- package/dist/run.js +0 -178
- package/dist/run.js.map +0 -1
- package/dist/security/certGenUtils.d.ts +0 -52
- package/dist/security/certGenUtils.js +0 -170
- package/dist/security/certGenUtils.js.map +0 -1
- package/dist/security/crl/generate-test-certs.d.ts +0 -34
- package/dist/security/crl/generate-test-certs.js +0 -81
- package/dist/security/crl/generate-test-certs.js.map +0 -1
- package/dist/security/ocsp/generate-test-certs.d.ts +0 -55
- package/dist/security/ocsp/generate-test-certs.js +0 -106
- package/dist/security/ocsp/generate-test-certs.js.map +0 -1
- package/dist/security/ocspServer.d.ts +0 -18
- package/dist/security/ocspServer.js +0 -132
- package/dist/security/ocspServer.js.map +0 -1
- package/dist/securityServices.d.ts +0 -49
- package/dist/securityServices.js +0 -120
- package/dist/securityServices.js.map +0 -1
- package/dist/src/harperLifecycle.d.ts +0 -156
- package/dist/src/harperLifecycle.js +0 -315
- package/dist/src/harperLifecycle.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -4
- package/dist/src/index.js.map +0 -1
- package/dist/src/loopbackAddressPool.d.ts +0 -50
- package/dist/src/loopbackAddressPool.js +0 -337
- package/dist/src/loopbackAddressPool.js.map +0 -1
- package/dist/src/run.d.ts +0 -2
- package/dist/src/run.js +0 -94
- package/dist/src/run.js.map +0 -1
- package/dist/src/security/certGenUtils.d.ts +0 -52
- package/dist/src/security/certGenUtils.js +0 -170
- package/dist/src/security/certGenUtils.js.map +0 -1
- package/dist/src/security/crl/generate-test-certs.d.ts +0 -34
- package/dist/src/security/crl/generate-test-certs.js +0 -81
- package/dist/src/security/crl/generate-test-certs.js.map +0 -1
- package/dist/src/security/ocsp/generate-test-certs.d.ts +0 -55
- package/dist/src/security/ocsp/generate-test-certs.js +0 -106
- package/dist/src/security/ocsp/generate-test-certs.js.map +0 -1
- package/dist/src/security/ocspServer.d.ts +0 -18
- package/dist/src/security/ocspServer.js +0 -132
- package/dist/src/security/ocspServer.js.map +0 -1
- package/dist/src/securityServices.d.ts +0 -49
- package/dist/src/securityServices.js +0 -120
- package/dist/src/securityServices.js.map +0 -1
- package/dist/src/targz.d.ts +0 -6
- package/dist/src/targz.js +0 -20
- package/dist/src/targz.js.map +0 -1
- package/dist/targz.d.ts +0 -6
- package/dist/targz.js +0 -20
- package/dist/targz.js.map +0 -1
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Services Utilities for Integration Tests
|
|
3
|
-
*
|
|
4
|
-
* This module provides utilities for managing OCSP responders, CRL servers,
|
|
5
|
-
* and certificate generation for security-related integration tests.
|
|
6
|
-
*
|
|
7
|
-
* All certificate generation and OCSP responding is done in pure Node.js
|
|
8
|
-
* using webcrypto + pkijs — no openssl CLI dependency.
|
|
9
|
-
*/
|
|
10
|
-
import { type Server } from 'node:http';
|
|
11
|
-
import type { OcspCertificates } from './security/ocsp/generate-test-certs.ts';
|
|
12
|
-
import type { CrlCertificates } from './security/crl/generate-test-certs.ts';
|
|
13
|
-
export interface OcspResponderContext {
|
|
14
|
-
server: Server;
|
|
15
|
-
port: number;
|
|
16
|
-
certsPath: string;
|
|
17
|
-
certs: OcspCertificates;
|
|
18
|
-
}
|
|
19
|
-
export interface CrlServerContext {
|
|
20
|
-
server: Server;
|
|
21
|
-
port: number;
|
|
22
|
-
certsPath: string;
|
|
23
|
-
certs: CrlCertificates;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Stop an OCSP responder server
|
|
27
|
-
*/
|
|
28
|
-
export declare function stopOcspResponder(ctx: OcspResponderContext): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Start a Node.js HTTP server to serve CRL files
|
|
31
|
-
*/
|
|
32
|
-
export declare function startCrlServer(certsPath: string, port: number, certs: CrlCertificates): Promise<CrlServerContext>;
|
|
33
|
-
/**
|
|
34
|
-
* Stop a CRL server
|
|
35
|
-
*/
|
|
36
|
-
export declare function stopCrlServer(ctx: CrlServerContext): Promise<void>;
|
|
37
|
-
export { generateOcspCertificates, type OcspCertificates } from './security/ocsp/generate-test-certs.ts';
|
|
38
|
-
export { generateCrlCertificates, type CrlCertificates } from './security/crl/generate-test-certs.ts';
|
|
39
|
-
/**
|
|
40
|
-
* Setup CRL server with automatic port allocation and retry on conflict
|
|
41
|
-
*/
|
|
42
|
-
export declare function setupCrlServerWithCerts(certsPath: string, hostname?: string, maxRetries?: number): Promise<CrlServerContext>;
|
|
43
|
-
/**
|
|
44
|
-
* Setup OCSP responder with automatic port allocation and retry on conflict
|
|
45
|
-
*
|
|
46
|
-
* Generates certificates with OCSP URL embedded, then starts the Node.js
|
|
47
|
-
* OCSP responder on the same port.
|
|
48
|
-
*/
|
|
49
|
-
export declare function setupOcspResponderWithCerts(certsPath: string, hostname?: string, maxRetries?: number): Promise<OcspResponderContext>;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Services Utilities for Integration Tests
|
|
3
|
-
*
|
|
4
|
-
* This module provides utilities for managing OCSP responders, CRL servers,
|
|
5
|
-
* and certificate generation for security-related integration tests.
|
|
6
|
-
*
|
|
7
|
-
* All certificate generation and OCSP responding is done in pure Node.js
|
|
8
|
-
* using webcrypto + pkijs — no openssl CLI dependency.
|
|
9
|
-
*/
|
|
10
|
-
import { createServer } from 'node:http';
|
|
11
|
-
import { join } from 'node:path';
|
|
12
|
-
import { readFileSync } from 'node:fs';
|
|
13
|
-
import { startOcspServer, stopOcspServer } from "./security/ocspServer.js";
|
|
14
|
-
/**
|
|
15
|
-
* Stop an OCSP responder server
|
|
16
|
-
*/
|
|
17
|
-
export async function stopOcspResponder(ctx) {
|
|
18
|
-
return stopOcspServer(ctx.server);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Start a Node.js HTTP server to serve CRL files
|
|
22
|
-
*/
|
|
23
|
-
export async function startCrlServer(certsPath, port, certs) {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
const server = createServer((req, res) => {
|
|
26
|
-
if (req.url === '/test.crl') {
|
|
27
|
-
try {
|
|
28
|
-
const crl = readFileSync(join(certsPath, 'test.crl'));
|
|
29
|
-
res.writeHead(200, {
|
|
30
|
-
'Content-Type': 'application/pkix-crl',
|
|
31
|
-
'Cache-Control': 'no-cache',
|
|
32
|
-
});
|
|
33
|
-
res.end(crl);
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
res.writeHead(500);
|
|
37
|
-
res.end('Internal Server Error');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else if (req.url === '/health') {
|
|
41
|
-
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
42
|
-
res.end('OK');
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
res.writeHead(404);
|
|
46
|
-
res.end('Not Found');
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
server.on('error', reject);
|
|
50
|
-
server.listen(port, () => {
|
|
51
|
-
const address = server.address();
|
|
52
|
-
if (!address || typeof address === 'string') {
|
|
53
|
-
reject(new Error('Server did not bind to a network port'));
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
resolve({
|
|
57
|
-
server,
|
|
58
|
-
port: address.port,
|
|
59
|
-
certsPath,
|
|
60
|
-
certs,
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Stop a CRL server
|
|
67
|
-
*/
|
|
68
|
-
export async function stopCrlServer(ctx) {
|
|
69
|
-
return new Promise((resolve) => {
|
|
70
|
-
ctx.server.close(() => resolve());
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
// Re-export certificate generation functions and types
|
|
74
|
-
export { generateOcspCertificates } from "./security/ocsp/generate-test-certs.js";
|
|
75
|
-
export { generateCrlCertificates } from "./security/crl/generate-test-certs.js";
|
|
76
|
-
/**
|
|
77
|
-
* Setup CRL server with automatic port allocation and retry on conflict
|
|
78
|
-
*/
|
|
79
|
-
export async function setupCrlServerWithCerts(certsPath, hostname = '127.0.0.1', maxRetries = 5) {
|
|
80
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
81
|
-
const port = 50000 + Math.floor(Math.random() * 10000);
|
|
82
|
-
try {
|
|
83
|
-
const { generateCrlCertificates } = await import("./security/crl/generate-test-certs.js");
|
|
84
|
-
const certs = await generateCrlCertificates(certsPath, hostname, port);
|
|
85
|
-
return startCrlServer(certsPath, port, certs);
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
if (error.code === 'EADDRINUSE' && attempt < maxRetries - 1) {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
throw new Error(`Failed to setup CRL server after ${attempt + 1} attempts: ${error.message}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
throw new Error(`Failed to setup CRL server after ${maxRetries} attempts`);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Setup OCSP responder with automatic port allocation and retry on conflict
|
|
98
|
-
*
|
|
99
|
-
* Generates certificates with OCSP URL embedded, then starts the Node.js
|
|
100
|
-
* OCSP responder on the same port.
|
|
101
|
-
*/
|
|
102
|
-
export async function setupOcspResponderWithCerts(certsPath, hostname = '127.0.0.1', maxRetries = 5) {
|
|
103
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
104
|
-
const port = 50000 + Math.floor(Math.random() * 10000);
|
|
105
|
-
try {
|
|
106
|
-
const { generateOcspCertificates } = await import("./security/ocsp/generate-test-certs.js");
|
|
107
|
-
const { files, serverCerts } = await generateOcspCertificates(certsPath, hostname, port);
|
|
108
|
-
const server = await startOcspServer(port, serverCerts);
|
|
109
|
-
return { server, port, certsPath, certs: files };
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
if (error.code === 'EADDRINUSE' && attempt < maxRetries - 1) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
throw new Error(`Failed to setup OCSP responder after ${attempt + 1} attempts: ${error.message}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
throw new Error(`Failed to setup OCSP responder after ${maxRetries} attempts`);
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=securityServices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityServices.js","sourceRoot":"","sources":["../../src/securityServices.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgB3E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAyB;IAChE,OAAO,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,SAAiB,EACjB,IAAY,EACZ,KAAsB;IAEtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACxC,IAAI,GAAG,CAAC,GAAG,KA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
import { createGzip } from 'node:zlib';
|
|
3
|
-
/**
|
|
4
|
-
* Packs and compresses a directory into a base64-encoded tar.gz string.
|
|
5
|
-
*
|
|
6
|
-
* @param dirPath path to directory to pack and compress
|
|
7
|
-
*/
|
|
8
|
-
export async function targz(dirPath) {
|
|
9
|
-
const chunks = [];
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
pack(dirPath)
|
|
12
|
-
.pipe(createGzip())
|
|
13
|
-
.on('data', (chunk) => chunks.push(chunk))
|
|
14
|
-
.on('end', () => {
|
|
15
|
-
resolve(Buffer.concat(chunks).toString('base64'));
|
|
16
|
-
})
|
|
17
|
-
.on('error', reject);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=targz.js.map
|
package/dist/src/targz.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targz.js","sourceRoot":"","sources":["../../src/targz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,CAAC,OAAO,CAAC;aACX,IAAI,CAAC,UAAU,EAAE,CAAC;aAClB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACjD,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACf,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/targz.d.ts
DELETED
package/dist/targz.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { pack } from 'tar-fs';
|
|
2
|
-
import { createGzip } from 'node:zlib';
|
|
3
|
-
/**
|
|
4
|
-
* Packs and compresses a directory into a base64-encoded tar.gz string.
|
|
5
|
-
*
|
|
6
|
-
* @param dirPath path to directory to pack and compress
|
|
7
|
-
*/
|
|
8
|
-
export async function targz(dirPath) {
|
|
9
|
-
const chunks = [];
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
pack(dirPath)
|
|
12
|
-
.pipe(createGzip())
|
|
13
|
-
.on('data', (chunk) => chunks.push(chunk))
|
|
14
|
-
.on('end', () => {
|
|
15
|
-
resolve(Buffer.concat(chunks).toString('base64'));
|
|
16
|
-
})
|
|
17
|
-
.on('error', reject);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=targz.js.map
|
package/dist/targz.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targz.js","sourceRoot":"","sources":["../src/targz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,CAAC,OAAO,CAAC;aACX,IAAI,CAAC,UAAU,EAAE,CAAC;aAClB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACjD,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACf,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|