fix: allow to set some x509 certificates in templates
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 29 May 2023 17:48:20 +0000 (19:48 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 29 May 2023 17:48:20 +0000 (19:48 +0200)
It's relevant for public root CA

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/SharedLRUCache.ts
src/types/ChargingStationInfo.ts
src/types/ChargingStationTemplate.ts

index f3d3274d448efb34e8b1bef96567b995f3975fdf..0d7a9dccec5fc04fbe19c4cbba386151d3af0265 100644 (file)
@@ -1,4 +1,4 @@
-import { LRUCacheWithDelete as LRUCache } from 'mnemonist';
+import { LRUMapWithDelete as LRUCache } from 'mnemonist';
 
 import { Bootstrap } from './Bootstrap';
 import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types';
index fff8a1ad69e6805034807c9df1052bf4b560cf43..2f9a07fc9c13ac5637af0a73caae1b7ddb4c6e19 100644 (file)
@@ -1,15 +1,6 @@
 import type { ChargingStationTemplate } from './ChargingStationTemplate';
 import type { FirmwareStatus } from './ocpp/Requests';
 
-enum x509CertificateType {
-  V2GRootCertificate = 'V2GRootCertificate',
-  MORootCertificate = 'MORootCertificate',
-  CSMSRootCertificate = 'CSMSRootCertificate',
-  ManufacturerRootCertificate = 'ManufacturerRootCertificate',
-  ChargingStationCertificate = 'ChargingStationCertificate',
-  V2GCertificate = 'V2GCertificate',
-}
-
 export type ChargingStationInfo = Omit<
   ChargingStationTemplate,
   | 'AutomaticTransactionGenerator'
@@ -32,7 +23,6 @@ export type ChargingStationInfo = Omit<
   maximumPower?: number; // Always in Watt
   maximumAmperage?: number; // Always in Ampere
   firmwareStatus?: FirmwareStatus;
-  x509Certificates?: Record<x509CertificateType, string>;
 };
 
 export type ChargingStationInfoConfiguration = {
index 0ba1899b285bb339ab43fe90cd9245be9b84a5db..10f9733fbe2f595a684c5a460babb29be13c7ae5 100644 (file)
@@ -55,6 +55,15 @@ type CommandsSupport = {
   outgoingCommands?: Record<RequestCommand, boolean>;
 };
 
+enum x509CertificateType {
+  V2GRootCertificate = 'V2GRootCertificate',
+  MORootCertificate = 'MORootCertificate',
+  CSMSRootCertificate = 'CSMSRootCertificate',
+  ManufacturerRootCertificate = 'ManufacturerRootCertificate',
+  ChargingStationCertificate = 'ChargingStationCertificate',
+  V2GCertificate = 'V2GCertificate',
+}
+
 export type ChargingStationTemplate = {
   templateHash?: string;
   supervisionUrls?: string | string[];
@@ -116,4 +125,5 @@ export type ChargingStationTemplate = {
   AutomaticTransactionGenerator?: AutomaticTransactionGeneratorConfiguration;
   Evses?: Record<string, EvseTemplate>;
   Connectors?: Record<string, ConnectorStatus>;
+  x509Certificates?: Record<x509CertificateType, string>;
 };