@cosyte/mllp 0.1.12 → 0.1.13
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 +7 -0
- package/dist/index.cjs +97 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -9
- package/dist/index.d.ts +55 -9
- package/dist/index.mjs +97 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -646,9 +646,10 @@ interface TlsOptions {
|
|
|
646
646
|
* {@link TlsOptions.passphrase}. The file's bytes, as `readFileSync` returns them; this package
|
|
647
647
|
* reads no file itself.
|
|
648
648
|
*
|
|
649
|
-
* The file is loaded
|
|
650
|
-
* `connect()
|
|
651
|
-
*
|
|
649
|
+
* The file is loaded once, when the client is created, from the copy of the options it takes
|
|
650
|
+
* then. One the TLS library cannot load rejects every `connect()`, before a socket is opened,
|
|
651
|
+
* with a typed `MllpTlsConfigurationError` carrying `MLLP_TLS_PFX_REJECTED`, whose message
|
|
652
|
+
* names this option and never its value: a wrong passphrase, bytes that are not
|
|
652
653
|
* PKCS#12, or a legacy encryption (RC2-40, as `openssl pkcs12 -export -legacy`, OpenSSL 1.x and
|
|
653
654
|
* older Windows exports write it) that Node.js, on OpenSSL 3, does not load. Re-export such a
|
|
654
655
|
* file with AES-256. The refusal is permanent: a client does not retry it.
|
|
@@ -1062,6 +1063,26 @@ declare const MLLP_TLS_PFX_REJECTED = "MLLP_TLS_PFX_REJECTED";
|
|
|
1062
1063
|
* ```
|
|
1063
1064
|
*/
|
|
1064
1065
|
declare const MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
|
|
1066
|
+
/**
|
|
1067
|
+
* `tls` was `null`, an array, a byte array (a `Buffer`, any other typed array, a `DataView`, an
|
|
1068
|
+
* `ArrayBuffer` or a `SharedArrayBuffer`), a `Map`, a `Set`, a `Date`, a `Promise`, a boxed
|
|
1069
|
+
* primitive or a value that is no object, rather than an object of TLS options (for a client,
|
|
1070
|
+
* `true` also asks for the defaults). Any other object is an object of options: a literal, a class
|
|
1071
|
+
* instance, an `Object.create` object or a module namespace object, whatever its
|
|
1072
|
+
* `Symbol.toStringTag`. Without this check such a value reached the options' property reads and
|
|
1073
|
+
* failed there with a bare `TypeError`, or was taken as TLS with no options at all.
|
|
1074
|
+
*
|
|
1075
|
+
* Like {@link MLLP_TLS_CREDENTIAL_CONFLICT}, this one is thrown by the constructor
|
|
1076
|
+
* (`createClient`, `createServer`, `new MllpClient`, `new MllpServer`). The message never carries
|
|
1077
|
+
* the value that was passed, and there is no `cause`.
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```typescript
|
|
1081
|
+
* import { MLLP_TLS_OPTIONS_NOT_AN_OBJECT } from '@cosyte/mllp';
|
|
1082
|
+
* if (err.code === MLLP_TLS_OPTIONS_NOT_AN_OBJECT) logger.error('tls must be an options object');
|
|
1083
|
+
* ```
|
|
1084
|
+
*/
|
|
1085
|
+
declare const MLLP_TLS_OPTIONS_NOT_AN_OBJECT = "MLLP_TLS_OPTIONS_NOT_AN_OBJECT";
|
|
1065
1086
|
/**
|
|
1066
1087
|
* Union of the stable TLS-configuration error codes.
|
|
1067
1088
|
*
|
|
@@ -1070,7 +1091,7 @@ declare const MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
|
|
|
1070
1091
|
* const code: TlsConfigurationErrorCode = 'MLLP_TLS_CIPHER_LIST_REJECTED';
|
|
1071
1092
|
* ```
|
|
1072
1093
|
*/
|
|
1073
|
-
type TlsConfigurationErrorCode = typeof MLLP_TLS_CIPHER_LIST_REJECTED | typeof MLLP_TLS_CIPHER_OPTION_CONFLICT | typeof MLLP_TLS_DH_PARAMETERS_REJECTED | typeof MLLP_TLS_CIPHER_LIST_UNENFORCEABLE | typeof MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE | typeof MLLP_TLS_PFX_REJECTED | typeof MLLP_TLS_CREDENTIAL_CONFLICT;
|
|
1094
|
+
type TlsConfigurationErrorCode = typeof MLLP_TLS_CIPHER_LIST_REJECTED | typeof MLLP_TLS_CIPHER_OPTION_CONFLICT | typeof MLLP_TLS_DH_PARAMETERS_REJECTED | typeof MLLP_TLS_CIPHER_LIST_UNENFORCEABLE | typeof MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE | typeof MLLP_TLS_PFX_REJECTED | typeof MLLP_TLS_CREDENTIAL_CONFLICT | typeof MLLP_TLS_OPTIONS_NOT_AN_OBJECT;
|
|
1074
1095
|
/**
|
|
1075
1096
|
* Fixed, human-readable description for a TLS-configuration code.
|
|
1076
1097
|
*
|
|
@@ -1306,15 +1327,15 @@ declare function resolveTlsCipherPolicy(opts: TlsCipherPolicyInput, side: "clien
|
|
|
1306
1327
|
* version and which cipher suite that link negotiated. This is that record,
|
|
1307
1328
|
* emitted once per completed handshake on both the client and the server.
|
|
1308
1329
|
*
|
|
1309
|
-
* It is a **log line**, so it carries no field content:
|
|
1310
|
-
* from the TLS session and
|
|
1330
|
+
* It is a **log line**, so it carries no field content: every value is read
|
|
1331
|
+
* from the TLS session and is a name out of a closed registry, never anything
|
|
1311
1332
|
* derived from the payload, the certificate, or the key.
|
|
1312
1333
|
*
|
|
1313
1334
|
* @example
|
|
1314
1335
|
* ```typescript
|
|
1315
1336
|
* import type { NegotiatedTlsParameters } from '@cosyte/mllp';
|
|
1316
1337
|
* client.on('tlsNegotiated', (p: NegotiatedTlsParameters) => {
|
|
1317
|
-
* logger.info({ tls: p.protocolVersion, suite: p.cipherSuite });
|
|
1338
|
+
* logger.info({ tls: p.protocolVersion, suite: p.cipherSuite, group: p.keyExchangeGroup });
|
|
1318
1339
|
* });
|
|
1319
1340
|
* ```
|
|
1320
1341
|
*
|
|
@@ -1327,7 +1348,7 @@ declare function resolveTlsCipherPolicy(opts: TlsCipherPolicyInput, side: "clien
|
|
|
1327
1348
|
* including every reconnect. Never emitted on a plaintext connection.
|
|
1328
1349
|
*
|
|
1329
1350
|
* Carries no HL7 payload content and no certificate or key material: only the
|
|
1330
|
-
*
|
|
1351
|
+
* negotiated names and the same routing metadata a `SecurityWarning`
|
|
1331
1352
|
* carries. It is emitted at handshake-completion time, before any HL7 byte has
|
|
1332
1353
|
* crossed the link.
|
|
1333
1354
|
*
|
|
@@ -1352,6 +1373,25 @@ interface NegotiatedTlsParameters {
|
|
|
1352
1373
|
* in, is a different rendering of the same suite.
|
|
1353
1374
|
*/
|
|
1354
1375
|
readonly cipherSuite: string;
|
|
1376
|
+
/**
|
|
1377
|
+
* The key-exchange group the handshake used, as the TLS library names it,
|
|
1378
|
+
* e.g. `'X25519'`, `'prime256v1'`, or a post-quantum hybrid such as
|
|
1379
|
+
* `'X25519MLKEM768'`. Standardized group names are the ones the IANA TLS
|
|
1380
|
+
* Supported Groups registry lists.
|
|
1381
|
+
*
|
|
1382
|
+
* Present only where the runtime reports the group, and **absent** (the key
|
|
1383
|
+
* is not on the object) everywhere else:
|
|
1384
|
+
*
|
|
1385
|
+
* - only on a **client** record: Node.js reports the group on a client socket
|
|
1386
|
+
* alone, so a server record never carries it;
|
|
1387
|
+
* - a classic elliptic-curve group (`'X25519'`, `'prime256v1'` and the like)
|
|
1388
|
+
* is reported on every supported Node.js line;
|
|
1389
|
+
* - a group with no classic key, such as a post-quantum hybrid, is reported
|
|
1390
|
+
* from Node.js 24.19.0 and 26.5.0; on Node.js 22 it is absent;
|
|
1391
|
+
* - a TLS 1.2 finite-field Diffie-Hellman exchange (a `DHE` suite) has no
|
|
1392
|
+
* group name to report, so it is absent there too.
|
|
1393
|
+
*/
|
|
1394
|
+
readonly keyExchangeGroup?: string;
|
|
1355
1395
|
/** Host associated with the link (the target host for clients; the bind host for servers). */
|
|
1356
1396
|
readonly host: string;
|
|
1357
1397
|
/** Port associated with the link. */
|
|
@@ -2368,6 +2408,8 @@ declare class MllpServer extends EventEmitter {
|
|
|
2368
2408
|
private readonly _netServer;
|
|
2369
2409
|
private readonly _connections;
|
|
2370
2410
|
private readonly _opts;
|
|
2411
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
2412
|
+
private readonly _tls;
|
|
2371
2413
|
/** `true` when `ServerOptions.tls` is set, `_netServer` is actually a `tls.Server`. */
|
|
2372
2414
|
private readonly _isTls;
|
|
2373
2415
|
private _listening;
|
|
@@ -3628,6 +3670,10 @@ interface ClientStats {
|
|
|
3628
3670
|
*/
|
|
3629
3671
|
declare class MllpClient extends EventEmitter {
|
|
3630
3672
|
private readonly _opts;
|
|
3673
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
3674
|
+
private readonly _tls;
|
|
3675
|
+
/** Why `tls.pfx` cannot be loaded, found once at construction; `undefined` when it loads or is unset. */
|
|
3676
|
+
private readonly _pfxRefusal;
|
|
3631
3677
|
private _connection;
|
|
3632
3678
|
private _socket;
|
|
3633
3679
|
/**
|
|
@@ -5466,5 +5512,5 @@ declare function runDifferential(options?: DifferentialRunOptions): Promise<Diff
|
|
|
5466
5512
|
*/
|
|
5467
5513
|
declare const VERSION: string;
|
|
5468
5514
|
|
|
5469
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5515
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_OPTIONS_NOT_AN_OBJECT, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5470
5516
|
export type { AckCode, AckCodeSelection, AckCodeSelectionInput, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionRejectedEvent, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -646,9 +646,10 @@ interface TlsOptions {
|
|
|
646
646
|
* {@link TlsOptions.passphrase}. The file's bytes, as `readFileSync` returns them; this package
|
|
647
647
|
* reads no file itself.
|
|
648
648
|
*
|
|
649
|
-
* The file is loaded
|
|
650
|
-
* `connect()
|
|
651
|
-
*
|
|
649
|
+
* The file is loaded once, when the client is created, from the copy of the options it takes
|
|
650
|
+
* then. One the TLS library cannot load rejects every `connect()`, before a socket is opened,
|
|
651
|
+
* with a typed `MllpTlsConfigurationError` carrying `MLLP_TLS_PFX_REJECTED`, whose message
|
|
652
|
+
* names this option and never its value: a wrong passphrase, bytes that are not
|
|
652
653
|
* PKCS#12, or a legacy encryption (RC2-40, as `openssl pkcs12 -export -legacy`, OpenSSL 1.x and
|
|
653
654
|
* older Windows exports write it) that Node.js, on OpenSSL 3, does not load. Re-export such a
|
|
654
655
|
* file with AES-256. The refusal is permanent: a client does not retry it.
|
|
@@ -1062,6 +1063,26 @@ declare const MLLP_TLS_PFX_REJECTED = "MLLP_TLS_PFX_REJECTED";
|
|
|
1062
1063
|
* ```
|
|
1063
1064
|
*/
|
|
1064
1065
|
declare const MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
|
|
1066
|
+
/**
|
|
1067
|
+
* `tls` was `null`, an array, a byte array (a `Buffer`, any other typed array, a `DataView`, an
|
|
1068
|
+
* `ArrayBuffer` or a `SharedArrayBuffer`), a `Map`, a `Set`, a `Date`, a `Promise`, a boxed
|
|
1069
|
+
* primitive or a value that is no object, rather than an object of TLS options (for a client,
|
|
1070
|
+
* `true` also asks for the defaults). Any other object is an object of options: a literal, a class
|
|
1071
|
+
* instance, an `Object.create` object or a module namespace object, whatever its
|
|
1072
|
+
* `Symbol.toStringTag`. Without this check such a value reached the options' property reads and
|
|
1073
|
+
* failed there with a bare `TypeError`, or was taken as TLS with no options at all.
|
|
1074
|
+
*
|
|
1075
|
+
* Like {@link MLLP_TLS_CREDENTIAL_CONFLICT}, this one is thrown by the constructor
|
|
1076
|
+
* (`createClient`, `createServer`, `new MllpClient`, `new MllpServer`). The message never carries
|
|
1077
|
+
* the value that was passed, and there is no `cause`.
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```typescript
|
|
1081
|
+
* import { MLLP_TLS_OPTIONS_NOT_AN_OBJECT } from '@cosyte/mllp';
|
|
1082
|
+
* if (err.code === MLLP_TLS_OPTIONS_NOT_AN_OBJECT) logger.error('tls must be an options object');
|
|
1083
|
+
* ```
|
|
1084
|
+
*/
|
|
1085
|
+
declare const MLLP_TLS_OPTIONS_NOT_AN_OBJECT = "MLLP_TLS_OPTIONS_NOT_AN_OBJECT";
|
|
1065
1086
|
/**
|
|
1066
1087
|
* Union of the stable TLS-configuration error codes.
|
|
1067
1088
|
*
|
|
@@ -1070,7 +1091,7 @@ declare const MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
|
|
|
1070
1091
|
* const code: TlsConfigurationErrorCode = 'MLLP_TLS_CIPHER_LIST_REJECTED';
|
|
1071
1092
|
* ```
|
|
1072
1093
|
*/
|
|
1073
|
-
type TlsConfigurationErrorCode = typeof MLLP_TLS_CIPHER_LIST_REJECTED | typeof MLLP_TLS_CIPHER_OPTION_CONFLICT | typeof MLLP_TLS_DH_PARAMETERS_REJECTED | typeof MLLP_TLS_CIPHER_LIST_UNENFORCEABLE | typeof MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE | typeof MLLP_TLS_PFX_REJECTED | typeof MLLP_TLS_CREDENTIAL_CONFLICT;
|
|
1094
|
+
type TlsConfigurationErrorCode = typeof MLLP_TLS_CIPHER_LIST_REJECTED | typeof MLLP_TLS_CIPHER_OPTION_CONFLICT | typeof MLLP_TLS_DH_PARAMETERS_REJECTED | typeof MLLP_TLS_CIPHER_LIST_UNENFORCEABLE | typeof MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE | typeof MLLP_TLS_PFX_REJECTED | typeof MLLP_TLS_CREDENTIAL_CONFLICT | typeof MLLP_TLS_OPTIONS_NOT_AN_OBJECT;
|
|
1074
1095
|
/**
|
|
1075
1096
|
* Fixed, human-readable description for a TLS-configuration code.
|
|
1076
1097
|
*
|
|
@@ -1306,15 +1327,15 @@ declare function resolveTlsCipherPolicy(opts: TlsCipherPolicyInput, side: "clien
|
|
|
1306
1327
|
* version and which cipher suite that link negotiated. This is that record,
|
|
1307
1328
|
* emitted once per completed handshake on both the client and the server.
|
|
1308
1329
|
*
|
|
1309
|
-
* It is a **log line**, so it carries no field content:
|
|
1310
|
-
* from the TLS session and
|
|
1330
|
+
* It is a **log line**, so it carries no field content: every value is read
|
|
1331
|
+
* from the TLS session and is a name out of a closed registry, never anything
|
|
1311
1332
|
* derived from the payload, the certificate, or the key.
|
|
1312
1333
|
*
|
|
1313
1334
|
* @example
|
|
1314
1335
|
* ```typescript
|
|
1315
1336
|
* import type { NegotiatedTlsParameters } from '@cosyte/mllp';
|
|
1316
1337
|
* client.on('tlsNegotiated', (p: NegotiatedTlsParameters) => {
|
|
1317
|
-
* logger.info({ tls: p.protocolVersion, suite: p.cipherSuite });
|
|
1338
|
+
* logger.info({ tls: p.protocolVersion, suite: p.cipherSuite, group: p.keyExchangeGroup });
|
|
1318
1339
|
* });
|
|
1319
1340
|
* ```
|
|
1320
1341
|
*
|
|
@@ -1327,7 +1348,7 @@ declare function resolveTlsCipherPolicy(opts: TlsCipherPolicyInput, side: "clien
|
|
|
1327
1348
|
* including every reconnect. Never emitted on a plaintext connection.
|
|
1328
1349
|
*
|
|
1329
1350
|
* Carries no HL7 payload content and no certificate or key material: only the
|
|
1330
|
-
*
|
|
1351
|
+
* negotiated names and the same routing metadata a `SecurityWarning`
|
|
1331
1352
|
* carries. It is emitted at handshake-completion time, before any HL7 byte has
|
|
1332
1353
|
* crossed the link.
|
|
1333
1354
|
*
|
|
@@ -1352,6 +1373,25 @@ interface NegotiatedTlsParameters {
|
|
|
1352
1373
|
* in, is a different rendering of the same suite.
|
|
1353
1374
|
*/
|
|
1354
1375
|
readonly cipherSuite: string;
|
|
1376
|
+
/**
|
|
1377
|
+
* The key-exchange group the handshake used, as the TLS library names it,
|
|
1378
|
+
* e.g. `'X25519'`, `'prime256v1'`, or a post-quantum hybrid such as
|
|
1379
|
+
* `'X25519MLKEM768'`. Standardized group names are the ones the IANA TLS
|
|
1380
|
+
* Supported Groups registry lists.
|
|
1381
|
+
*
|
|
1382
|
+
* Present only where the runtime reports the group, and **absent** (the key
|
|
1383
|
+
* is not on the object) everywhere else:
|
|
1384
|
+
*
|
|
1385
|
+
* - only on a **client** record: Node.js reports the group on a client socket
|
|
1386
|
+
* alone, so a server record never carries it;
|
|
1387
|
+
* - a classic elliptic-curve group (`'X25519'`, `'prime256v1'` and the like)
|
|
1388
|
+
* is reported on every supported Node.js line;
|
|
1389
|
+
* - a group with no classic key, such as a post-quantum hybrid, is reported
|
|
1390
|
+
* from Node.js 24.19.0 and 26.5.0; on Node.js 22 it is absent;
|
|
1391
|
+
* - a TLS 1.2 finite-field Diffie-Hellman exchange (a `DHE` suite) has no
|
|
1392
|
+
* group name to report, so it is absent there too.
|
|
1393
|
+
*/
|
|
1394
|
+
readonly keyExchangeGroup?: string;
|
|
1355
1395
|
/** Host associated with the link (the target host for clients; the bind host for servers). */
|
|
1356
1396
|
readonly host: string;
|
|
1357
1397
|
/** Port associated with the link. */
|
|
@@ -2368,6 +2408,8 @@ declare class MllpServer extends EventEmitter {
|
|
|
2368
2408
|
private readonly _netServer;
|
|
2369
2409
|
private readonly _connections;
|
|
2370
2410
|
private readonly _opts;
|
|
2411
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
2412
|
+
private readonly _tls;
|
|
2371
2413
|
/** `true` when `ServerOptions.tls` is set, `_netServer` is actually a `tls.Server`. */
|
|
2372
2414
|
private readonly _isTls;
|
|
2373
2415
|
private _listening;
|
|
@@ -3628,6 +3670,10 @@ interface ClientStats {
|
|
|
3628
3670
|
*/
|
|
3629
3671
|
declare class MllpClient extends EventEmitter {
|
|
3630
3672
|
private readonly _opts;
|
|
3673
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
3674
|
+
private readonly _tls;
|
|
3675
|
+
/** Why `tls.pfx` cannot be loaded, found once at construction; `undefined` when it loads or is unset. */
|
|
3676
|
+
private readonly _pfxRefusal;
|
|
3631
3677
|
private _connection;
|
|
3632
3678
|
private _socket;
|
|
3633
3679
|
/**
|
|
@@ -5466,5 +5512,5 @@ declare function runDifferential(options?: DifferentialRunOptions): Promise<Diff
|
|
|
5466
5512
|
*/
|
|
5467
5513
|
declare const VERSION: string;
|
|
5468
5514
|
|
|
5469
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5515
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_OPTIONS_NOT_AN_OBJECT, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, MllpWarning, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, Transport, VERSION, WarningCode, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5470
5516
|
export type { AckCode, AckCodeSelection, AckCodeSelectionInput, AckCorrelationCode, AckCorrelationWarning, AckModeCode, AckModeWarning, AckModeWarningEvent, ApplicationAckFailure, CanonicalExchange, ClientAuth, ClientOptions, ClientStats, CommitAckReport, ConnectionErrorCause, ConnectionErrorPhase, ConnectionOptions, ConnectionRejectedEvent, ConnectionState, ConnectionStats, DifferentialConfigurationErrorCode, DifferentialConnect, DifferentialCorrelationOutcome, DifferentialDeviation, DifferentialExchangeOutcome, DifferentialExchangeReport, DifferentialParityOutcome, DifferentialPeer, DifferentialReport, DifferentialReportPeer, DifferentialRunOptions, DifferentialRunResult, DifferentialSkipReason, EncoderOptions, FrameReaderOptions, MessageMeta, NackAckCode, NackEvent, NackReason, NegativeAckCode, NegotiatedTlsParameters, PemInput, ReconnectingEvent, ResolvedTlsCipherPolicy, RetryContext, RetryStrategy, SecurityWarning, SecurityWarningCode, ServerOptions, ServerStats, ServerTlsOptions, StarterClientOptions, StarterServerOptions, StateChangeEvent, TlsCipherPolicyInput, TlsConfigurationErrorCode, TlsOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { createSecureContext, createServer as createServer$2, connect, checkServ
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import { createServer as createServer$1, createConnection, isIP, SocketAddress } from 'net';
|
|
5
|
+
import { types } from 'util';
|
|
5
6
|
|
|
6
7
|
// src/framing/registry.ts
|
|
7
8
|
function createWarning(code, byteOffset, message) {
|
|
@@ -648,6 +649,7 @@ var MLLP_TLS_CIPHER_LIST_UNENFORCEABLE = "MLLP_TLS_CIPHER_LIST_UNENFORCEABLE";
|
|
|
648
649
|
var MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE = "MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE";
|
|
649
650
|
var MLLP_TLS_PFX_REJECTED = "MLLP_TLS_PFX_REJECTED";
|
|
650
651
|
var MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
|
|
652
|
+
var MLLP_TLS_OPTIONS_NOT_AN_OBJECT = "MLLP_TLS_OPTIONS_NOT_AN_OBJECT";
|
|
651
653
|
function tlsConfigurationMessage(code) {
|
|
652
654
|
const messages = {
|
|
653
655
|
[MLLP_TLS_CIPHER_LIST_REJECTED]: "the TLS library rejected the configured cipher-suite list; no connection was opened and no fallback to the runtime default list was made",
|
|
@@ -656,7 +658,8 @@ function tlsConfigurationMessage(code) {
|
|
|
656
658
|
[MLLP_TLS_CIPHER_LIST_UNENFORCEABLE]: "this runtime's TLS library does not enforce a configured cipher-suite list; no connection was opened, rather than one offering a list other than the one configured",
|
|
657
659
|
[MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE]: "this runtime's TLS library does not enforce server Diffie-Hellman parameters; nothing was bound, rather than a server running without the parameters configured",
|
|
658
660
|
[MLLP_TLS_PFX_REJECTED]: "tls.pfx could not be loaded with tls.passphrase: the passphrase is wrong, the file is not PKCS#12, or it uses a legacy encryption (RC2-40, as `openssl pkcs12 -export -legacy` and older exports write it) that OpenSSL 3 does not load, so re-export it with AES-256; no socket was opened",
|
|
659
|
-
[MLLP_TLS_CREDENTIAL_CONFLICT]: "tls.pfx was set together with tls.cert or tls.key; the PKCS#12 file carries its own certificate and key, so set either cert and key or pfx, not both"
|
|
661
|
+
[MLLP_TLS_CREDENTIAL_CONFLICT]: "tls.pfx was set together with tls.cert or tls.key; the PKCS#12 file carries its own certificate and key, so set either cert and key or pfx, not both",
|
|
662
|
+
[MLLP_TLS_OPTIONS_NOT_AN_OBJECT]: "tls must be an object of TLS options, or true for a client's defaults; it was null, an array, another kind of object or a value that is no object, and no client or server was created"
|
|
660
663
|
};
|
|
661
664
|
return messages[code];
|
|
662
665
|
}
|
|
@@ -924,14 +927,23 @@ function readNegotiatedTlsParameters(socket, host, port) {
|
|
|
924
927
|
const cipher = socket.getCipher();
|
|
925
928
|
const cipherSuite = cipher.standardName === "" ? cipher.name : cipher.standardName;
|
|
926
929
|
if (cipherSuite === "") return null;
|
|
930
|
+
const keyExchangeGroup = readKeyExchangeGroup(socket);
|
|
927
931
|
return Object.freeze({
|
|
928
932
|
protocolVersion,
|
|
929
933
|
cipherSuite,
|
|
934
|
+
...keyExchangeGroup === void 0 ? {} : { keyExchangeGroup },
|
|
930
935
|
host,
|
|
931
936
|
port,
|
|
932
937
|
timestamp: /* @__PURE__ */ new Date()
|
|
933
938
|
});
|
|
934
939
|
}
|
|
940
|
+
function readKeyExchangeGroup(socket) {
|
|
941
|
+
if (typeof socket.getEphemeralKeyInfo !== "function") return void 0;
|
|
942
|
+
const info = socket.getEphemeralKeyInfo();
|
|
943
|
+
if (typeof info !== "object" || info === null || !("name" in info)) return void 0;
|
|
944
|
+
const { name } = info;
|
|
945
|
+
return typeof name === "string" && name !== "" ? name : void 0;
|
|
946
|
+
}
|
|
935
947
|
|
|
936
948
|
// src/connection/error.ts
|
|
937
949
|
var MllpConnectionError = class _MllpConnectionError extends Error {
|
|
@@ -1429,14 +1441,59 @@ function checkCredentialMix(tls) {
|
|
|
1429
1441
|
throw new MllpTlsConfigurationError(MLLP_TLS_CREDENTIAL_CONFLICT);
|
|
1430
1442
|
}
|
|
1431
1443
|
}
|
|
1432
|
-
function
|
|
1433
|
-
if (pfx === void 0) return;
|
|
1444
|
+
function pfxRefusal(pfx, passphrase) {
|
|
1445
|
+
if (pfx === void 0) return void 0;
|
|
1434
1446
|
try {
|
|
1435
1447
|
createSecureContext({ pfx, passphrase });
|
|
1448
|
+
return void 0;
|
|
1436
1449
|
} catch (err) {
|
|
1437
|
-
|
|
1450
|
+
return new MllpTlsConfigurationError(MLLP_TLS_PFX_REJECTED, { cause: err });
|
|
1438
1451
|
}
|
|
1439
1452
|
}
|
|
1453
|
+
function checkPfx(pfx, passphrase) {
|
|
1454
|
+
const refusal = pfxRefusal(pfx, passphrase);
|
|
1455
|
+
if (refusal !== void 0) throw refusal;
|
|
1456
|
+
}
|
|
1457
|
+
function tlsOptionNames() {
|
|
1458
|
+
const names = {
|
|
1459
|
+
ca: "ca",
|
|
1460
|
+
cert: "cert",
|
|
1461
|
+
key: "key",
|
|
1462
|
+
passphrase: "passphrase",
|
|
1463
|
+
pfx: "pfx",
|
|
1464
|
+
servername: "servername",
|
|
1465
|
+
minVersion: "minVersion",
|
|
1466
|
+
maxVersion: "maxVersion",
|
|
1467
|
+
atnaTransportSecurity: "atnaTransportSecurity",
|
|
1468
|
+
ciphers: "ciphers",
|
|
1469
|
+
allowUnverified: "allowUnverified",
|
|
1470
|
+
clientAuth: "clientAuth",
|
|
1471
|
+
dhParameters: "dhParameters"
|
|
1472
|
+
};
|
|
1473
|
+
return Object.values(names);
|
|
1474
|
+
}
|
|
1475
|
+
function copyValue(value) {
|
|
1476
|
+
return ArrayBuffer.isView(value) ? Buffer.from(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)) : value;
|
|
1477
|
+
}
|
|
1478
|
+
function isOptionsObject(value) {
|
|
1479
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1480
|
+
return !(Array.isArray(value) || ArrayBuffer.isView(value) || types.isAnyArrayBuffer(value) || types.isMap(value) || types.isSet(value) || types.isDate(value) || types.isPromise(value) || types.isBoxedPrimitive(value));
|
|
1481
|
+
}
|
|
1482
|
+
function copyTlsOptions(tls) {
|
|
1483
|
+
if (tls === void 0 || tls === true) return tls;
|
|
1484
|
+
const given = tls;
|
|
1485
|
+
if (!isOptionsObject(given)) {
|
|
1486
|
+
throw new MllpTlsConfigurationError(MLLP_TLS_OPTIONS_NOT_AN_OBJECT);
|
|
1487
|
+
}
|
|
1488
|
+
const source = given;
|
|
1489
|
+
const copy = {};
|
|
1490
|
+
for (const name of tlsOptionNames()) {
|
|
1491
|
+
const value = source[name];
|
|
1492
|
+
if (value === void 0) continue;
|
|
1493
|
+
copy[name] = Array.isArray(value) ? value.map(copyValue) : copyValue(value);
|
|
1494
|
+
}
|
|
1495
|
+
return copy;
|
|
1496
|
+
}
|
|
1440
1497
|
|
|
1441
1498
|
// src/internal/control-id.ts
|
|
1442
1499
|
var ASCII_M = 77;
|
|
@@ -1823,6 +1880,8 @@ var MllpServer = class extends EventEmitter {
|
|
|
1823
1880
|
_netServer;
|
|
1824
1881
|
_connections = /* @__PURE__ */ new Set();
|
|
1825
1882
|
_opts;
|
|
1883
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
1884
|
+
_tls;
|
|
1826
1885
|
/** `true` when `ServerOptions.tls` is set, `_netServer` is actually a `tls.Server`. */
|
|
1827
1886
|
_isTls;
|
|
1828
1887
|
_listening = false;
|
|
@@ -1877,27 +1936,33 @@ var MllpServer = class extends EventEmitter {
|
|
|
1877
1936
|
"ServerOptions.maxConnections must be a positive integer, or left unset for no cap"
|
|
1878
1937
|
);
|
|
1879
1938
|
}
|
|
1880
|
-
const tlsInput = opts.tls;
|
|
1939
|
+
const tlsInput = copyTlsOptions(opts.tls);
|
|
1881
1940
|
checkCredentialMix(tlsInput);
|
|
1882
1941
|
if (tlsInput !== void 0 && tlsInput.pfx === void 0 && (tlsInput.cert === void 0 || tlsInput.key === void 0)) {
|
|
1883
1942
|
throw new TypeError("ServerOptions.tls needs cert and key, or pfx");
|
|
1884
1943
|
}
|
|
1885
1944
|
this._opts = opts;
|
|
1886
|
-
this.
|
|
1945
|
+
this._tls = tlsInput;
|
|
1946
|
+
this._isTls = tlsInput !== void 0;
|
|
1887
1947
|
let cipherPolicy = null;
|
|
1888
|
-
if (
|
|
1948
|
+
if (tlsInput !== void 0) {
|
|
1889
1949
|
try {
|
|
1890
|
-
checkPfx(
|
|
1891
|
-
cipherPolicy = resolveTlsCipherPolicy(
|
|
1950
|
+
checkPfx(tlsInput.pfx, tlsInput.passphrase);
|
|
1951
|
+
cipherPolicy = resolveTlsCipherPolicy(tlsInput, "server");
|
|
1892
1952
|
} catch (err) {
|
|
1893
1953
|
if (!(err instanceof MllpTlsConfigurationError)) throw err;
|
|
1894
1954
|
this._tlsConfigError = err;
|
|
1895
1955
|
}
|
|
1896
1956
|
}
|
|
1897
|
-
if (
|
|
1957
|
+
if (tlsInput === void 0) {
|
|
1898
1958
|
this._netServer = createServer$1();
|
|
1899
|
-
|
|
1900
|
-
|
|
1959
|
+
this._netServer.on("connection", (socket) => {
|
|
1960
|
+
this._onSocketAccepted(socket);
|
|
1961
|
+
});
|
|
1962
|
+
} else if (cipherPolicy === null) {
|
|
1963
|
+
this._netServer = createServer$1();
|
|
1964
|
+
} else {
|
|
1965
|
+
const tlsOpts = tlsInput;
|
|
1901
1966
|
const clientAuth = tlsOpts.clientAuth ?? "NONE";
|
|
1902
1967
|
const tlsServer = createServer$2({
|
|
1903
1968
|
cert: tlsOpts.cert,
|
|
@@ -1928,11 +1993,6 @@ var MllpServer = class extends EventEmitter {
|
|
|
1928
1993
|
});
|
|
1929
1994
|
this._emitContained("tlsClientError", event);
|
|
1930
1995
|
});
|
|
1931
|
-
} else {
|
|
1932
|
-
this._netServer = createServer$1();
|
|
1933
|
-
this._netServer.on("connection", (socket) => {
|
|
1934
|
-
this._onSocketAccepted(socket);
|
|
1935
|
-
});
|
|
1936
1996
|
}
|
|
1937
1997
|
this._netServer.on("error", (err) => {
|
|
1938
1998
|
if (this.listenerCount("error") > 0) {
|
|
@@ -2444,7 +2504,7 @@ var MllpServer = class extends EventEmitter {
|
|
|
2444
2504
|
}
|
|
2445
2505
|
}
|
|
2446
2506
|
);
|
|
2447
|
-
const peerCertificate =
|
|
2507
|
+
const peerCertificate = (this._tls?.clientAuth ?? "NONE") !== "NONE" ? this._extractPeerCertificateSummary(socket) : null;
|
|
2448
2508
|
this._emitContained(
|
|
2449
2509
|
"connection",
|
|
2450
2510
|
Object.freeze({
|
|
@@ -3409,6 +3469,10 @@ function identityOptions(host, servername) {
|
|
|
3409
3469
|
}
|
|
3410
3470
|
var MllpClient = class extends EventEmitter {
|
|
3411
3471
|
_opts;
|
|
3472
|
+
/** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
|
|
3473
|
+
_tls;
|
|
3474
|
+
/** Why `tls.pfx` cannot be loaded, found once at construction; `undefined` when it loads or is unset. */
|
|
3475
|
+
_pfxRefusal;
|
|
3412
3476
|
_connection = null;
|
|
3413
3477
|
_socket = null;
|
|
3414
3478
|
/**
|
|
@@ -3544,7 +3608,10 @@ var MllpClient = class extends EventEmitter {
|
|
|
3544
3608
|
"ClientOptions.connectTimeoutMs must be an integer from 1 to 2147483647, or left unset for no bound"
|
|
3545
3609
|
);
|
|
3546
3610
|
}
|
|
3547
|
-
|
|
3611
|
+
const tls = copyTlsOptions(opts.tls);
|
|
3612
|
+
checkCredentialMix(tls);
|
|
3613
|
+
this._pfxRefusal = typeof tls === "object" ? pfxRefusal(tls.pfx, tls.passphrase) : void 0;
|
|
3614
|
+
this._tls = tls;
|
|
3548
3615
|
this._opts = opts;
|
|
3549
3616
|
this._ackTimeoutMs = opts.ackTimeoutMs ?? 3e4;
|
|
3550
3617
|
this._applicationAckTimeoutMs = opts.applicationAckTimeoutMs;
|
|
@@ -3662,7 +3729,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
3662
3729
|
}
|
|
3663
3730
|
const conn = new Connection(connOpts);
|
|
3664
3731
|
this._attachConnection(conn);
|
|
3665
|
-
const connectEventName = this.
|
|
3732
|
+
const connectEventName = this._tls !== void 0 ? "secureConnect" : "connect";
|
|
3666
3733
|
this._armConnectTimeout(socket, connectEventName);
|
|
3667
3734
|
const cleanup = () => {
|
|
3668
3735
|
if (signal !== void 0) {
|
|
@@ -3732,14 +3799,14 @@ var MllpClient = class extends EventEmitter {
|
|
|
3732
3799
|
* against it.
|
|
3733
3800
|
*/
|
|
3734
3801
|
_createSocketAndTransport() {
|
|
3735
|
-
const tlsOpt = this.
|
|
3802
|
+
const tlsOpt = this._tls;
|
|
3736
3803
|
if (tlsOpt === void 0) {
|
|
3737
3804
|
const socket2 = createConnection({ host: this._opts.host, port: this._opts.port });
|
|
3738
3805
|
return { socket: socket2, transport: new NetTransport(socket2) };
|
|
3739
3806
|
}
|
|
3740
3807
|
const tlsOpts = tlsOpt === true ? {} : tlsOpt;
|
|
3741
3808
|
const cipherPolicy = resolveTlsCipherPolicy(tlsOpts, "client");
|
|
3742
|
-
|
|
3809
|
+
if (this._pfxRefusal !== void 0) throw this._pfxRefusal;
|
|
3743
3810
|
const socket = connect({
|
|
3744
3811
|
host: this._opts.host,
|
|
3745
3812
|
port: this._opts.port,
|
|
@@ -3800,7 +3867,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
3800
3867
|
connectionCause: "connect-timeout"
|
|
3801
3868
|
});
|
|
3802
3869
|
}
|
|
3803
|
-
if (this.
|
|
3870
|
+
if (this._tls === void 0) {
|
|
3804
3871
|
return new MllpConnectionError(err.message, { cause: err, phase });
|
|
3805
3872
|
}
|
|
3806
3873
|
const code = err.code;
|
|
@@ -3909,7 +3976,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
3909
3976
|
* connections or when verification is on.
|
|
3910
3977
|
*/
|
|
3911
3978
|
_emitInsecureWarningIfNeeded() {
|
|
3912
|
-
const tlsOpt = this.
|
|
3979
|
+
const tlsOpt = this._tls;
|
|
3913
3980
|
if (tlsOpt === void 0 || tlsOpt === true) return;
|
|
3914
3981
|
if (tlsOpt.allowUnverified !== true) return;
|
|
3915
3982
|
const message = "MLLP TLS certificate verification is DISABLED (allowUnverified: true), this connection does not authenticate the peer.";
|
|
@@ -3934,7 +4001,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
3934
4001
|
* built at handshake-completion time, before any HL7 byte crosses the link.
|
|
3935
4002
|
*/
|
|
3936
4003
|
_emitNegotiatedTlsParameters(socket) {
|
|
3937
|
-
if (this.
|
|
4004
|
+
if (this._tls === void 0) return;
|
|
3938
4005
|
const params = readNegotiatedTlsParameters(socket, this._opts.host, this._opts.port);
|
|
3939
4006
|
if (params === null) return;
|
|
3940
4007
|
this._emitContained("tlsNegotiated", params);
|
|
@@ -4177,7 +4244,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
4177
4244
|
}
|
|
4178
4245
|
}
|
|
4179
4246
|
}
|
|
4180
|
-
const tlsProtocolShaped = this.
|
|
4247
|
+
const tlsProtocolShaped = this._tls !== void 0 && isTlsProtocolError(err);
|
|
4181
4248
|
const classifiedAs = !tlsProtocolShaped && isTransientConnectionError(err) ? "transient" : "permanent";
|
|
4182
4249
|
if (classifiedAs === "permanent") {
|
|
4183
4250
|
this._userClosed = true;
|
|
@@ -4292,7 +4359,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
4292
4359
|
this._emitInsecureWarningIfNeeded();
|
|
4293
4360
|
this._emitNegotiatedTlsParameters(socket);
|
|
4294
4361
|
};
|
|
4295
|
-
const connectEventName = this.
|
|
4362
|
+
const connectEventName = this._tls !== void 0 ? "secureConnect" : "connect";
|
|
4296
4363
|
this._armConnectTimeout(socket, connectEventName);
|
|
4297
4364
|
socket.once("error", (sErr) => {
|
|
4298
4365
|
if (this._lastError === null || this._lastError.message !== sErr.message) {
|
|
@@ -5100,7 +5167,7 @@ var MllpClient = class extends EventEmitter {
|
|
|
5100
5167
|
reconnectAttempts: this._reconnectAttempts,
|
|
5101
5168
|
lastConnectedAt: this._lastConnectedAt,
|
|
5102
5169
|
lastAckAt: this._lastAckAt,
|
|
5103
|
-
tls: this.
|
|
5170
|
+
tls: this._tls !== void 0
|
|
5104
5171
|
};
|
|
5105
5172
|
}
|
|
5106
5173
|
/**
|
|
@@ -5457,8 +5524,8 @@ async function runDifferential(options = {}) {
|
|
|
5457
5524
|
}
|
|
5458
5525
|
|
|
5459
5526
|
// src/index.ts
|
|
5460
|
-
var VERSION = "0.1.
|
|
5527
|
+
var VERSION = "0.1.13";
|
|
5461
5528
|
|
|
5462
|
-
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, VERSION, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, createWarning, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5529
|
+
export { ATNA_CIPHER_LIST, ATNA_CIPHER_SUITES, Connection, FrameReader, MLLP_BIND_ALL_INTERFACES, MLLP_CONNECTION_LIMIT_REACHED, MLLP_DIFF_PEER_UNPARSEABLE, MLLP_TLS_CIPHER_LIST_REJECTED, MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, MLLP_TLS_CIPHER_OPTION_CONFLICT, MLLP_TLS_CREDENTIAL_CONFLICT, MLLP_TLS_DH_PARAMETERS_REJECTED, MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, MLLP_TLS_OPTIONS_NOT_AN_OBJECT, MLLP_TLS_PFX_REJECTED, MLLP_TLS_VERIFY_DISABLED, MllpAckError, MllpApplicationAckError, MllpBackpressureError, MllpClient, MllpCommitRejectedError, MllpConnectionError, MllpDifferentialConfigurationError, MllpFramingError, MllpNeverDeliveredError, MllpServer, MllpTimeoutError, MllpTlsConfigurationError, MllpUnknownFateError, NetTransport, TLS13_DEFAULT_CIPHER_SUITES, TlsTransport, VERSION, ackDiagnosticMessage, ackModeDiagnosticMessage, buildRawAck, canonicalAcknowledgement, canonicalExchanges, createClient, createServer, createStarterClient, createStarterServer, createWarning, differentialConfigurationMessage, encodeFrame, isTlsProtocolError, isTlsVerificationErrorCode, isTransientConnectionError, rawAckUncorrelatable, readNegotiatedTlsParameters, resolveDifferentialPeer, resolveNackCode, resolveTlsCipherPolicy, runDifferential, selectAckCode, tlsConfigurationMessage };
|
|
5463
5530
|
//# sourceMappingURL=index.mjs.map
|
|
5464
5531
|
//# sourceMappingURL=index.mjs.map
|