@elastic/synthetics
Version:
Elastic synthetic monitoring agent
55 lines • 2.85 kB
TypeScript
/**
* MIT License
*
* Copyright (c) 2020-present, Elastic NV
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
import { CertificateErrorSpkiAllowlist } from '../common_types';
/**
* Normalize user-provided PEM certificates (string, Buffer, or an array of
* either) into a flat list of PEM strings. Each entry may itself be a bundle
* that contains more than one certificate.
*/
export declare function normalizeCertificateErrorSpkiAllowlist(certificates?: CertificateErrorSpkiAllowlist): string[];
/**
* Split a PEM bundle into the individual certificates it contains. Node's
* `X509Certificate` only parses the first certificate of a bundle, so we have
* to slice them apart ourselves to support full chains / multiple CAs.
*/
export declare function splitPemCertificates(pem: string): string[];
/**
* Compute the base64 encoded SHA-256 fingerprint of a certificate's
* SubjectPublicKeyInfo (SPKI). This is the exact value Chromium expects in the
* `--ignore-certificate-errors-spki-list` switch.
*/
export declare function getSpkiFingerprint(pem: string): string;
/**
* Build the list of SPKI fingerprints for all supplied certificates. Chromium
* uses this list to bypass certificate errors for matching presented
* certificates; it does not establish CA trust. Invalid certificates are
* skipped, with a warning, so a single bad entry never aborts the whole run
* but also never fails silently - a `certificateErrorSpkiAllowlist` entry that
* doesn't resolve to a real file and isn't valid PEM (e.g. a typo'd path)
* would otherwise never be allowlisted, and matching endpoints would keep
* failing certificate validation with no indication why.
*/
export declare function getSpkiFingerprints(certificates?: CertificateErrorSpkiAllowlist): string[];
//# sourceMappingURL=certs.d.ts.map