@zetra/citrineos-certificates 1.8.3-fork.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/module/2.0.1/MessageApi.d.ts +35 -0
- package/dist/module/2.0.1/MessageApi.js +108 -0
- package/dist/module/2.0.1/MessageApi.js.map +1 -0
- package/dist/module/DataApi.d.ts +72 -0
- package/dist/module/DataApi.js +321 -0
- package/dist/module/DataApi.js.map +1 -0
- package/dist/module/installCertificateHelperService.d.ts +49 -0
- package/dist/module/installCertificateHelperService.js +282 -0
- package/dist/module/installCertificateHelperService.js.map +1 -0
- package/dist/module/interface.d.ts +5 -0
- package/dist/module/interface.js +5 -0
- package/dist/module/interface.js.map +1 -0
- package/dist/module/module.d.ts +93 -0
- package/dist/module/module.js +429 -0
- package/dist/module/module.js.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { Certificate, CountryNameEnumType, InstallCertificateAttempt, InstalledCertificate, SignatureAlgorithmEnumType, UploadExistingCertificate, } from '@citrineos/data';
|
|
5
|
+
import { extractCertificateDetails, generateCSR, WebsocketNetworkConnection, } from '@citrineos/util';
|
|
6
|
+
import { OCPP2_0_1 } from '@citrineos/base';
|
|
7
|
+
import { Logger } from 'tslog';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import jsrsasign from 'jsrsasign';
|
|
10
|
+
export var PemType;
|
|
11
|
+
(function (PemType) {
|
|
12
|
+
PemType["Root"] = "Root";
|
|
13
|
+
PemType["SubCA"] = "SubCA";
|
|
14
|
+
PemType["Leaf"] = "Leaf";
|
|
15
|
+
})(PemType || (PemType = {}));
|
|
16
|
+
export class InstallCertificateHelperService {
|
|
17
|
+
certificateRepository;
|
|
18
|
+
installedCertificateRepository;
|
|
19
|
+
installCertificateAttemptRepository;
|
|
20
|
+
deleteCertificateAttemptRepository;
|
|
21
|
+
certificateAuthorityService;
|
|
22
|
+
networkConnection;
|
|
23
|
+
fileStorage;
|
|
24
|
+
logger;
|
|
25
|
+
constructor(certificateRepository, installedCertificateRepository, installCertificateAttemptRepository, deleteCertificateAttemptRepository, certificateAuthorityService, networkConnection, fileStorage, logger) {
|
|
26
|
+
this.certificateRepository = certificateRepository;
|
|
27
|
+
this.installedCertificateRepository = installedCertificateRepository;
|
|
28
|
+
this.installCertificateAttemptRepository = installCertificateAttemptRepository;
|
|
29
|
+
this.deleteCertificateAttemptRepository = deleteCertificateAttemptRepository;
|
|
30
|
+
this.certificateAuthorityService = certificateAuthorityService;
|
|
31
|
+
this.networkConnection = networkConnection;
|
|
32
|
+
this.fileStorage = fileStorage;
|
|
33
|
+
this.logger = logger;
|
|
34
|
+
}
|
|
35
|
+
async prepareToInstallCertificate(tenantId, stationId, certificate, certificateType) {
|
|
36
|
+
const hash = this.getCertificateHash(certificate);
|
|
37
|
+
const existingPendingInstallCertificateAttempt = await this.installCertificateAttemptRepository.readOnlyOneByQuery(tenantId, {
|
|
38
|
+
where: {
|
|
39
|
+
stationId: stationId,
|
|
40
|
+
certificateType: certificateType,
|
|
41
|
+
status: null,
|
|
42
|
+
},
|
|
43
|
+
include: [
|
|
44
|
+
{
|
|
45
|
+
model: Certificate,
|
|
46
|
+
where: {
|
|
47
|
+
certificateFileHash: hash,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
if (!existingPendingInstallCertificateAttempt) {
|
|
53
|
+
const { serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm, } = extractCertificateDetails(certificate);
|
|
54
|
+
let existingCertificate = await this.certificateRepository.readOnlyOneByQuery(tenantId, {
|
|
55
|
+
where: {
|
|
56
|
+
certificateFileHash: hash,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (!existingCertificate) {
|
|
60
|
+
existingCertificate = await this.createNewCertificate(certificate, serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm);
|
|
61
|
+
}
|
|
62
|
+
const installCertificateAttempt = new InstallCertificateAttempt();
|
|
63
|
+
installCertificateAttempt.stationId = stationId;
|
|
64
|
+
installCertificateAttempt.certificateType = certificateType;
|
|
65
|
+
installCertificateAttempt.certificateId = existingCertificate.id;
|
|
66
|
+
await installCertificateAttempt.save();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async finalizeInstalledCertificate(tenantId, stationId, status) {
|
|
70
|
+
const existingPendingInstallCertificateAttempt = await this.installCertificateAttemptRepository.readOnlyOneByQuery(tenantId, {
|
|
71
|
+
where: {
|
|
72
|
+
stationId,
|
|
73
|
+
status: null,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
// should always be true
|
|
77
|
+
if (existingPendingInstallCertificateAttempt) {
|
|
78
|
+
existingPendingInstallCertificateAttempt.status = status;
|
|
79
|
+
await existingPendingInstallCertificateAttempt.save();
|
|
80
|
+
if (existingPendingInstallCertificateAttempt.status ===
|
|
81
|
+
OCPP2_0_1.InstallCertificateStatusEnumType.Accepted) {
|
|
82
|
+
const existingInstalledCertificate = await this.installedCertificateRepository.readOnlyOneByQuery(tenantId, {
|
|
83
|
+
where: {
|
|
84
|
+
stationId,
|
|
85
|
+
certificateType: existingPendingInstallCertificateAttempt.certificateType,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
if (existingInstalledCertificate) {
|
|
89
|
+
existingInstalledCertificate.certificateId =
|
|
90
|
+
existingPendingInstallCertificateAttempt.certificateId;
|
|
91
|
+
await existingInstalledCertificate.save();
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const certificate = await existingPendingInstallCertificateAttempt.$get('certificate');
|
|
95
|
+
if (certificate && certificate.certificateFileId) {
|
|
96
|
+
const certificateBuffer = await this.fileStorage.getFile(certificate.certificateFileId);
|
|
97
|
+
if (!certificateBuffer) {
|
|
98
|
+
this.logger.error('Failed to retrieve certificate file from storage for certificate', certificate);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const certificateString = certificateBuffer.toString();
|
|
102
|
+
const cert = new jsrsasign.X509();
|
|
103
|
+
cert.readCertPEM(certificateString);
|
|
104
|
+
const installedCertificate = new InstalledCertificate();
|
|
105
|
+
installedCertificate.stationId = stationId;
|
|
106
|
+
installedCertificate.certificateId =
|
|
107
|
+
existingPendingInstallCertificateAttempt.certificateId;
|
|
108
|
+
installedCertificate.certificateType =
|
|
109
|
+
existingPendingInstallCertificateAttempt.certificateType;
|
|
110
|
+
await installedCertificate.save();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async createNewCertificate(certificate, serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm) {
|
|
117
|
+
const certificateHash = this.getCertificateHash(certificate);
|
|
118
|
+
const newCertificate = new Certificate();
|
|
119
|
+
newCertificate.serialNumber = serialNumber;
|
|
120
|
+
newCertificate.issuerName = issuerName;
|
|
121
|
+
newCertificate.organizationName = organizationName;
|
|
122
|
+
newCertificate.commonName = commonName;
|
|
123
|
+
newCertificate.countryName = countryName;
|
|
124
|
+
newCertificate.validBefore = validBefore?.toISOString();
|
|
125
|
+
newCertificate.signatureAlgorithm = signatureAlgorithm;
|
|
126
|
+
newCertificate.certificateFileId = await this.fileStorage.saveFile(`Existing_Cert_${serialNumber}.pem`, Buffer.from(certificate));
|
|
127
|
+
newCertificate.certificateFileHash = certificateHash;
|
|
128
|
+
return await newCertificate.save();
|
|
129
|
+
}
|
|
130
|
+
async handleUploadExistingCertificate(tenantId, identifier, uploadExistingCertificate, filePath) {
|
|
131
|
+
this.logger.info(`Uploading existing ${uploadExistingCertificate.certificateType} certificate for charger ${identifier}`);
|
|
132
|
+
const certificate = uploadExistingCertificate.certificate;
|
|
133
|
+
const { serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm, } = extractCertificateDetails(certificate);
|
|
134
|
+
let existingInstalledCertificate = await this.installedCertificateRepository.readOnlyOneByQuery(tenantId, {
|
|
135
|
+
where: {
|
|
136
|
+
stationId: identifier,
|
|
137
|
+
certificateType: uploadExistingCertificate.certificateType,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
if (existingInstalledCertificate) {
|
|
141
|
+
let existingCertificate = await existingInstalledCertificate.$get('certificate');
|
|
142
|
+
if (existingCertificate && existingCertificate.certificateFileId) {
|
|
143
|
+
throw new Error('Cannot upload exiting certificate because it already exists');
|
|
144
|
+
}
|
|
145
|
+
else if (existingCertificate && !existingCertificate.certificateFileId) {
|
|
146
|
+
// set file where previously undefined
|
|
147
|
+
existingCertificate.certificateFileId = await this.fileStorage.saveFile(`Existing_Key_${serialNumber}.pem`, Buffer.from(certificate), filePath);
|
|
148
|
+
await existingCertificate.save();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// check if certificate record exists but not tied to installed certificate
|
|
152
|
+
existingCertificate = await this.certificateRepository.readOnlyOneByQuery(tenantId, {
|
|
153
|
+
where: {
|
|
154
|
+
certificateFileHash: this.getCertificateHash(certificate),
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
if (!existingCertificate) {
|
|
158
|
+
// create new certificate record
|
|
159
|
+
existingCertificate = await this.createNewCertificate(certificate, serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm);
|
|
160
|
+
}
|
|
161
|
+
existingInstalledCertificate.certificateId = existingCertificate.id;
|
|
162
|
+
existingInstalledCertificate = await existingInstalledCertificate.save();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// check if certificate record exists
|
|
167
|
+
let existingCertificate = await this.certificateRepository.readOnlyOneByQuery(tenantId, {
|
|
168
|
+
where: {
|
|
169
|
+
certificateFileHash: this.getCertificateHash(certificate),
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
// create new certificate record
|
|
173
|
+
if (!existingCertificate) {
|
|
174
|
+
existingCertificate = await this.createNewCertificate(certificate, serialNumber, issuerName, organizationName, commonName, countryName, validBefore, signatureAlgorithm);
|
|
175
|
+
}
|
|
176
|
+
existingInstalledCertificate = new InstalledCertificate();
|
|
177
|
+
existingInstalledCertificate.stationId = identifier;
|
|
178
|
+
existingInstalledCertificate.certificateId = existingCertificate.id;
|
|
179
|
+
existingInstalledCertificate.certificateType = uploadExistingCertificate.certificateType;
|
|
180
|
+
existingInstalledCertificate = await existingInstalledCertificate.save();
|
|
181
|
+
}
|
|
182
|
+
return existingInstalledCertificate;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Generates a sub CA certificate signed by a CA server.
|
|
186
|
+
*
|
|
187
|
+
* @param {Certificate} certificate - The certificate information used for generating the root certificate.
|
|
188
|
+
* @return {Promise<[string, string]>} An array containing the signed certificate and the private key.
|
|
189
|
+
*/
|
|
190
|
+
async generateSubCACertificateSignedByCAServer(certificate) {
|
|
191
|
+
const [csrPem, privateKeyPem] = generateCSR(certificate);
|
|
192
|
+
const signedCertificate = await this.certificateAuthorityService.signedSubCaCertificateByExternalCA(csrPem);
|
|
193
|
+
return [signedCertificate, privateKeyPem];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Store certificate in file storage and db.
|
|
197
|
+
* @param certificateEntity certificate to be stored in db
|
|
198
|
+
* @param certPem certificate pem to be stored in file storage
|
|
199
|
+
* @param keyPem private key pem to be stored in file storage
|
|
200
|
+
* @param filePrefix prefix for file name to be stored in file storage
|
|
201
|
+
* @param filePath file path in file storage
|
|
202
|
+
* @return certificate stored in db
|
|
203
|
+
*/
|
|
204
|
+
async storeCertificateAndKey(tenantId, certificateEntity, certPem, keyPem, filePrefix, filePath) {
|
|
205
|
+
const certificateHash = this.getCertificateHash(certPem);
|
|
206
|
+
// Store certificate and private key in file storage
|
|
207
|
+
certificateEntity.privateKeyFileId = await this.fileStorage.saveFile(`${filePrefix}_Key_${certificateEntity.serialNumber}.pem`, Buffer.from(keyPem), filePath);
|
|
208
|
+
certificateEntity.certificateFileId = await this.fileStorage.saveFile(`${filePrefix}_Certificate_${certificateEntity.serialNumber}.pem`, Buffer.from(certPem), filePath);
|
|
209
|
+
certificateEntity.certificateFileHash = certificateHash;
|
|
210
|
+
// Store certificate in db
|
|
211
|
+
const certObj = new jsrsasign.X509();
|
|
212
|
+
certObj.readCertPEM(certPem);
|
|
213
|
+
certificateEntity.issuerName = certObj.getIssuerString();
|
|
214
|
+
certificateEntity.tenantId = tenantId;
|
|
215
|
+
return await this.certificateRepository.createOrUpdateCertificate(tenantId, certificateEntity);
|
|
216
|
+
}
|
|
217
|
+
updateCertificates(serverConfig, serverId, tlsKey, tlsCertificateChain, subCAKey, rootCA) {
|
|
218
|
+
let rollbackFiles = [];
|
|
219
|
+
if (serverConfig.tlsKeyFilePath && serverConfig.tlsCertificateChainFilePath) {
|
|
220
|
+
try {
|
|
221
|
+
rollbackFiles = this.replaceFile(serverConfig.tlsKeyFilePath, tlsKey, rollbackFiles);
|
|
222
|
+
rollbackFiles = this.replaceFile(serverConfig.tlsCertificateChainFilePath, tlsCertificateChain, rollbackFiles);
|
|
223
|
+
if (serverConfig.mtlsCertificateAuthorityKeyFilePath && subCAKey) {
|
|
224
|
+
rollbackFiles = this.replaceFile(serverConfig.mtlsCertificateAuthorityKeyFilePath, subCAKey, rollbackFiles);
|
|
225
|
+
}
|
|
226
|
+
if (serverConfig.rootCACertificateFilePath && rootCA) {
|
|
227
|
+
rollbackFiles = this.replaceFile(serverConfig.rootCACertificateFilePath, rootCA, rollbackFiles);
|
|
228
|
+
}
|
|
229
|
+
// Update the security context of the server without restarting it
|
|
230
|
+
this.networkConnection.updateTlsCertificates(serverId, tlsKey, tlsCertificateChain, rootCA);
|
|
231
|
+
// Update the map which stores sub CA certs and keys for websocket server securityProfile 3.
|
|
232
|
+
// This map is used when signing charging station certificates for use case A02 in OCPP 2.0.1 Part 2.
|
|
233
|
+
if (serverConfig.securityProfile === 3 && subCAKey) {
|
|
234
|
+
this.certificateAuthorityService.updateSecurityCertChainKeyMap(serverId, tlsCertificateChain, subCAKey);
|
|
235
|
+
}
|
|
236
|
+
this.logger.info(`Updated TLS certificate for server ${serverId} successfully.`);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
this.logger.error(`Failed to update certificate for server ${serverId}: `, error);
|
|
240
|
+
this.logger.info('Performing rollback...');
|
|
241
|
+
for (const { oldFilePath, newFilePath } of rollbackFiles) {
|
|
242
|
+
fs.renameSync(newFilePath, oldFilePath);
|
|
243
|
+
this.logger.info(`Rolled back ${newFilePath} to ${oldFilePath}`);
|
|
244
|
+
}
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
replaceFile(targetFilePath, newContent, rollbackFiles) {
|
|
250
|
+
// Back up old file
|
|
251
|
+
fs.renameSync(targetFilePath, targetFilePath.concat('.backup'));
|
|
252
|
+
rollbackFiles.push({
|
|
253
|
+
oldFilePath: targetFilePath,
|
|
254
|
+
newFilePath: targetFilePath.concat('.backup'),
|
|
255
|
+
});
|
|
256
|
+
// Write new content using target path
|
|
257
|
+
fs.writeFileSync(targetFilePath, newContent);
|
|
258
|
+
this.logger.debug(`Backed up and overwrote file ${targetFilePath}`);
|
|
259
|
+
return rollbackFiles;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Generate a hash (fingerprint) from a certificate PEM string.
|
|
263
|
+
* @param pemString The certificate PEM string.
|
|
264
|
+
* @returns A SHA-256 hash of the certificate's DER encoding.
|
|
265
|
+
*/
|
|
266
|
+
getCertificateHash(pemString) {
|
|
267
|
+
try {
|
|
268
|
+
const cert = new jsrsasign.X509();
|
|
269
|
+
cert.readCertPEM(pemString);
|
|
270
|
+
// Get the raw DER encoding of the certificate
|
|
271
|
+
const derHex = cert.hex;
|
|
272
|
+
// Compute SHA-256 hash
|
|
273
|
+
const hash = jsrsasign.KJUR.crypto.Util.sha256(derHex);
|
|
274
|
+
return hash;
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
console.error('Error generating certificate hash:', error);
|
|
278
|
+
throw new Error('Invalid PEM format or unsupported certificate');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=installCertificateHelperService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installCertificateHelperService.js","sourceRoot":"","sources":["../../src/module/installCertificateHelperService.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AACtC,OAAO,EACL,WAAW,EACX,mBAAmB,EAKnB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,yBAAyB,EACzB,WAAW,EACX,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAgB,MAAM,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,CAAN,IAAkB,OAIjB;AAJD,WAAkB,OAAO;IACvB,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,wBAAa,CAAA;AACf,CAAC,EAJiB,OAAO,KAAP,OAAO,QAIxB;AAOD,MAAM,OAAO,+BAA+B;IAChC,qBAAqB,CAAyB;IAC9C,8BAA8B,CAAkC;IAChE,mCAAmC,CAAuC;IAC1E,kCAAkC,CAAsC;IACxE,2BAA2B,CAA8B;IACzD,iBAAiB,CAA6B;IAC9C,WAAW,CAAe;IAC1B,MAAM,CAAkB;IAElC,YACE,qBAA6C,EAC7C,8BAA+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CAAC,SAAS,CAAC;SAC9C,CAAC,CAAC;QACH,sCAAsC;QACtC,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,cAAc,EAAE,CAAC,CAAC;QACpE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,SAAiB;QAClC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;YAClC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAE5B,8CAA8C;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;YAExB,uBAAuB;YACvB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEvD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/module/interface.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AbstractModule, type BootstrapConfig, type CallAction, type HandlerProperties, type ICache, type IFileStorage, type IMessage, type IMessageHandler, type IMessageSender, OCPP2_0_1, OCPPValidator, type SystemConfig } from '@citrineos/base';
|
|
2
|
+
import type { ICertificateRepository, IDeleteCertificateAttemptRepository, IDeviceModelRepository, IInstallCertificateAttemptRepository, IInstalledCertificateRepository, IOCPPMessageRepository } from '@citrineos/data';
|
|
3
|
+
import { CertificateAuthorityService, WebsocketNetworkConnection } from '@citrineos/util';
|
|
4
|
+
import { InstallCertificateHelperService } from './installCertificateHelperService.js';
|
|
5
|
+
import type { ILogObj } from 'tslog';
|
|
6
|
+
import { Logger } from 'tslog';
|
|
7
|
+
/**
|
|
8
|
+
* Component that handles provisioning related messages.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CertificatesModule extends AbstractModule {
|
|
11
|
+
/**
|
|
12
|
+
* Fields
|
|
13
|
+
*/
|
|
14
|
+
_requests: CallAction[];
|
|
15
|
+
_responses: CallAction[];
|
|
16
|
+
protected _deviceModelRepository: IDeviceModelRepository;
|
|
17
|
+
protected _certificateRepository: ICertificateRepository;
|
|
18
|
+
protected _installedCertificateRepository: IInstalledCertificateRepository;
|
|
19
|
+
protected _installCertificateAttemptRepository: IInstallCertificateAttemptRepository;
|
|
20
|
+
protected _deleteCertificateAttemptRepository: IDeleteCertificateAttemptRepository;
|
|
21
|
+
protected _ocppMessageRepository: IOCPPMessageRepository;
|
|
22
|
+
protected _certificateAuthorityService: CertificateAuthorityService;
|
|
23
|
+
protected _fileStorage: IFileStorage;
|
|
24
|
+
protected _installCertificateHelperService: InstallCertificateHelperService;
|
|
25
|
+
/**
|
|
26
|
+
* Constructor
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* This is the constructor function that initializes the {@link CertificatesModule}.
|
|
30
|
+
*
|
|
31
|
+
* @param {BootstrapConfig & SystemConfig} config - The `config` contains configuration settings for the module.
|
|
32
|
+
*
|
|
33
|
+
* @param {ICache} [cache] - The cache instance which is shared among the modules & Central System to pass information such as blacklisted actions or boot status.
|
|
34
|
+
*
|
|
35
|
+
* @param {IMessageSender} [sender] - The `sender` parameter is an optional parameter that represents an instance of the {@link IMessageSender} interface.
|
|
36
|
+
* It is used to send messages from the central system to external systems or devices. If no `sender` is provided, a default {@link RabbitMqSender} instance is created and used.
|
|
37
|
+
*
|
|
38
|
+
* @param {IMessageHandler} [handler] - The `handler` parameter is an optional parameter that represents an instance of the {@link IMessageHandler} interface.
|
|
39
|
+
* It is used to handle incoming messages and dispatch them to the appropriate methods or functions. If no `handler` is provided, a default {@link RabbitMqReceiver} instance is created and used.
|
|
40
|
+
*
|
|
41
|
+
* @param {IFileStorage} [fileStorage] - file storage for persisting certs
|
|
42
|
+
*
|
|
43
|
+
* @param {WebsocketNetworkConnection} [networkConnection] - network connection
|
|
44
|
+
*
|
|
45
|
+
* @param {Logger<ILogObj>} [logger] - The `logger` parameter is an optional parameter that represents an instance of {@link Logger<ILogObj>}.
|
|
46
|
+
* It is used to propagate system wide logger settings and will serve as the parent logger for any sub-component logging. If no `logger` is provided, a default {@link Logger<ILogObj>} instance is created and used.
|
|
47
|
+
*
|
|
48
|
+
* @param {IDeviceModelRepository} [deviceModelRepository] - An optional parameter of type {@link IDeviceModelRepository} which represents a repository for accessing and manipulating variable data.
|
|
49
|
+
* If no `deviceModelRepository` is provided, a default {@link sequelize.deviceModelRepository} instance is created and used.
|
|
50
|
+
*
|
|
51
|
+
* @param {ICertificateRepository} [certificateRepository] - An optional parameter of type {@link ICertificateRepository} which
|
|
52
|
+
* represents a repository for accessing and manipulating variable data.
|
|
53
|
+
* If no `deviceModelRepository` is provided, a default {@link sequelize.certificateRepository} instance is created and used.
|
|
54
|
+
*
|
|
55
|
+
* @param {IInstalledCertificateRepository} [installedCertificateRepository] - An optional parameter of type {@link IInstalledCertificateRepository} which
|
|
56
|
+
* represents a repository for accessing and manipulating installed certificate data.
|
|
57
|
+
* If no `installedCertificateRepository` is provided, a default {@link sequelize.InstalledCertificateRepository} instance is created and used.
|
|
58
|
+
*
|
|
59
|
+
* @param {IInstallCertificateAttemptRepository} [installCertificateAttemptRepository] - An optional parameter of type {@link IInstallCertificateAttemptRepository} which
|
|
60
|
+
* represents a repository for accessing and manipulating installed certificate attempt data.
|
|
61
|
+
* If no `installCertificateAttemptRepository` is provided, a default {@link sequelize.InstallCertificateAttemptRepository} instance is created and used.
|
|
62
|
+
*
|
|
63
|
+
* @param {IDeleteCertificateAttemptRepository} [deleteCertificateAttemptRepository] - An optional parameter of type {@link IDeleteCertificateAttemptRepository} which
|
|
64
|
+
* represents a repository for accessing and manipulating deleted certificate attempt data.
|
|
65
|
+
* If no `deleteCertificateAttemptRepository` is provided, a default {@link sequelize.DeleteCertificateAttemptRepository} instance is created and used.
|
|
66
|
+
*
|
|
67
|
+
* @param {IOCPPMessageRepository} [ocppMessageRepository] - repository to check ocpp messages
|
|
68
|
+
*
|
|
69
|
+
* @param {CertificateAuthorityService} [certificateAuthorityService] - An optional parameter of type {@link CertificateAuthorityService} which handles certificate authority operations.
|
|
70
|
+
*
|
|
71
|
+
* @param {InstallCertificateHelperService} [installCertificateHelperService] - helper service for installing certificates
|
|
72
|
+
*/
|
|
73
|
+
constructor(config: BootstrapConfig & SystemConfig, cache: ICache, sender: IMessageSender, handler: IMessageHandler, fileStorage: IFileStorage, networkConnection: WebsocketNetworkConnection, logger?: Logger<ILogObj>, ocppValidator?: OCPPValidator, deviceModelRepository?: IDeviceModelRepository, certificateRepository?: ICertificateRepository, installedCertificateRepository?: IInstalledCertificateRepository, installCertificateAttemptRepository?: IInstallCertificateAttemptRepository, deleteCertificateAttemptRepository?: IDeleteCertificateAttemptRepository, ocppMessageRepository?: IOCPPMessageRepository, certificateAuthorityService?: CertificateAuthorityService, installCertificateHelperService?: InstallCertificateHelperService);
|
|
74
|
+
get certificateAuthorityService(): CertificateAuthorityService;
|
|
75
|
+
get certificateRepository(): ICertificateRepository;
|
|
76
|
+
get installedCertificateRepository(): IInstalledCertificateRepository;
|
|
77
|
+
get deleteCertificateAttemptRepository(): IDeleteCertificateAttemptRepository;
|
|
78
|
+
get installCertificateHelperService(): InstallCertificateHelperService;
|
|
79
|
+
/**
|
|
80
|
+
* Handle requests
|
|
81
|
+
*/
|
|
82
|
+
protected _handleGet15118EVCertificate(message: IMessage<OCPP2_0_1.Get15118EVCertificateRequest>, props?: HandlerProperties): Promise<void>;
|
|
83
|
+
protected _handleGetCertificateStatus(message: IMessage<OCPP2_0_1.GetCertificateStatusRequest>, props?: HandlerProperties): Promise<void>;
|
|
84
|
+
protected _handleSignCertificate(message: IMessage<OCPP2_0_1.SignCertificateRequest>, props?: HandlerProperties): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Handle responses
|
|
87
|
+
*/
|
|
88
|
+
protected _handleCertificateSigned(message: IMessage<OCPP2_0_1.CertificateSignedResponse>, props?: HandlerProperties): Promise<void>;
|
|
89
|
+
protected _handleDeleteCertificate(message: IMessage<OCPP2_0_1.DeleteCertificateResponse>, props?: HandlerProperties): Promise<void>;
|
|
90
|
+
protected _handleGetInstalledCertificateIds(message: IMessage<OCPP2_0_1.GetInstalledCertificateIdsResponse>, props?: HandlerProperties): Promise<void>;
|
|
91
|
+
protected _handleInstallCertificate(message: IMessage<OCPP2_0_1.InstallCertificateResponse>, props?: HandlerProperties): Promise<void>;
|
|
92
|
+
private _verifySignCertRequest;
|
|
93
|
+
}
|