@citrineos/util
Version:
The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.
43 lines (42 loc) • 1.84 kB
TypeScript
import { IFileStorage, OCPP2_0_1, SystemConfig } from '@citrineos/base';
import { ILogObj, Logger } from 'tslog';
/**
* Util to process and validate signed meter values.
*/
export declare class SignedMeterValuesUtil {
private readonly _fileStorage;
private readonly _logger;
private readonly _chargingStationSecurityInfoRepository;
private readonly _signedMeterValuesConfiguration;
/**
* @param {IFileStorage} [fileStorage] - The `fileStorage` allows access to the configured file storage.
*
* @param {SystemConfig} config - The `config` contains the current system configuration settings.
*
* @param {Logger<ILogObj>} [logger] - The `logger` represents an instance of {@link Logger<ILogObj>}.
*
*/
constructor(fileStorage: IFileStorage, config: SystemConfig, logger: Logger<ILogObj>);
/**
* Checks the validity of a meter value.
*
* If a meter value is unsigned, it is valid.
*
* If a meter value is signed, it is valid if:
* - SignedMeterValuesConfig is configured
* AND
* - The incoming signed meter value's signing method matches the configured signing method
* AND
* - The incoming signed meter value's public key is empty but there is a public key stored for that charging station
* OR
* - The incoming signed meter value's public key isn't empty and it matches the configured public key
*
* @param stationId - The charging station the meter values belong to
* @param meterValues - The list of meter values
*/
validateMeterValues(stationId: string, meterValues: [OCPP2_0_1.MeterValueType, ...OCPP2_0_1.MeterValueType[]]): Promise<boolean>;
private validateSignedSampledValue;
private validateSignedMeterValueSignature;
private validateRsaSignature;
private formatKey;
}