Skip to main content
Version: v0.0.3

Function: isTlsVerificationErrorCode()

isTlsVerificationErrorCode(code): boolean

Set of Node/OpenSSL error codes that indicate a certificate-verification failure (as opposed to some other TLS handshake failure), untrusted chain, expired/not-yet-valid certificate, hostname mismatch, revocation, etc.

Used by MllpClient to classify a TLS connect failure's connectionCause as 'tls-verify' (this set) vs 'tls-handshake' (everything else observed before 'secureConnect'). Exported so callers can apply the same classification to their own error handling.

Parameters

code

string

Returns

boolean

Example

import { isTlsVerificationErrorCode } from '@cosyte/mllp';
if (isTlsVerificationErrorCode('CERT_HAS_EXPIRED')) {
// definitely a verification failure, not a protocol/cipher mismatch
}