UNPKG

@citrineos/util

Version:

The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.

39 lines (38 loc) 2.35 kB
import type { ICache, SystemConfig } from '@citrineos/base'; import { OCPP2_0_1 } from '@citrineos/base'; import type { IChargingStationCertificateAuthorityClient, IV2GCertificateAuthorityClient } from './client/interface.js'; import type { ILogObj } from 'tslog'; import { Logger } from 'tslog'; export declare class CertificateAuthorityService { private readonly _v2gClient; private readonly _chargingStationClient; private readonly _logger; private readonly _cache; private readonly _config; constructor(config: SystemConfig, cache: ICache, logger?: Logger<ILogObj>, chargingStationClient?: IChargingStationCertificateAuthorityClient, v2gClient?: IV2GCertificateAuthorityClient); /** * Retrieves the certificate chain for V2G- and Charging Station certificates. * * @param {string} csrString - The Certificate Signing Request string. * @param {string} stationId - The station identifier. * @param {CertificateSigningUseEnumType} [certificateType] - The type of certificate to retrieve. * @return {Promise<string>} The certificate chain without the root certificate. */ getCertificateChain(csrString: string, stationId: string, certificateType?: OCPP2_0_1.CertificateSigningUseEnumType | null): Promise<string>; signedSubCaCertificateByExternalCA(csrString: string): Promise<string>; getSignedContractData(iso15118SchemaVersion: string, exiRequest: string): Promise<string>; getRootCACertificateFromExternalCA(certificateType: OCPP2_0_1.InstallCertificateUseEnumType): Promise<string>; updateSecurityCertChainKeyMap(serverId: string, certificateChain: string, privateKey: string): void; validateCertificateChainPem(certificateChainPem: string): Promise<OCPP2_0_1.AuthorizeCertificateStatusEnumType>; validateCertificateHashData(ocspRequestData: OCPP2_0_1.OCSPRequestDataType[]): Promise<OCPP2_0_1.AuthorizeCertificateStatusEnumType>; /** * Create a certificate chain including leaf and sub CA certificates except for the root certificate. * * @param {string} signedCert - The leaf certificate. * @param {string} caCerts - CA certificates. * @return {string} The certificate chain pem. */ private _createCertificateChainWithoutRootCA; private _instantiateV2GClient; private _instantiateChargingStationClient; }