@citrineos/util
Version:
The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.
43 lines (42 loc) • 1.96 kB
TypeScript
import type { IV2GCertificateAuthorityClient } from './interface.js';
import { type ICache, type SystemConfig } from '@citrineos/base';
import type { ILogObj } from 'tslog';
import { Logger } from 'tslog';
export declare class Hubject implements IV2GCertificateAuthorityClient {
private readonly _baseUrl;
private readonly _tokenUrl;
private readonly _clientId;
private readonly _clientSecret;
private readonly _logger;
private readonly _cache;
private static readonly AUTH_TOKEN_CACHE_KEY;
private static readonly AUTH_TOKEN_CACHE_NAMESPACE;
constructor(config: SystemConfig, cache: ICache, logger?: Logger<ILogObj>);
/**
* Retrieves a signed certificate based on the provided CSR.
* DOC: https://hubject.stoplight.io/docs/open-plugncharge/486f0b8b3ded4-simple-enroll-iso-15118-2-and-iso-15118-20
*
* @param {string} csrString - The certificate signing request from SignCertificateRequest.
* @return {Promise<string>} The signed certificate without header and footer.
*/
getSignedCertificate(csrString: string): Promise<string>;
/**
* Retrieves the CA certificates including sub CAs and root CA.
* DOC: https://hubject.stoplight.io/docs/open-plugncharge/e246aa213bc22-obtaining-ca-certificates-iso-15118-2-and-iso-15118-20
*
* @return {Promise<string>} The CA certificates.
*/
getCACertificates(): Promise<string>;
getSignedContractData(xsdMsgDefNamespace: string, certificateInstallationReq: string): Promise<string>;
/**
* Retrieves all root certificates from Hubject.
* Refer to https://hubject.stoplight.io/docs/open-plugncharge/fdc9bdfdd4fb2-get-all-root-certificates
*
* @return {Promise<string[]>} Array of root certificate.
*/
getRootCertificates(): Promise<string[]>;
private _getDefaultToken;
private _getAuthorizationToken;
private _fetchNewToken;
private _makeAuthenticatedRequest;
}