node-opcua-pki 6.6.0 → 6.7.0
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/bin/pki.mjs +5 -7
- package/dist/bin/pki.mjs.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2051,6 +2051,7 @@ var CertificateManager = class _CertificateManager extends import_node_events.Ev
|
|
|
2051
2051
|
return "BadCertificateInvalid" /* BadCertificateInvalid */;
|
|
2052
2052
|
}
|
|
2053
2053
|
if (certificates.length > 1) {
|
|
2054
|
+
await this.#scanCertFolder(this.issuersCertFolder, this.#thumbs.issuers.certs);
|
|
2054
2055
|
for (const issuerCert of certificates.slice(1)) {
|
|
2055
2056
|
const thumbprint = makeFingerprint(issuerCert);
|
|
2056
2057
|
if (!await this.hasIssuer(thumbprint)) {
|
|
@@ -2401,9 +2402,7 @@ var CertificateManager = class _CertificateManager extends import_node_events.Ev
|
|
|
2401
2402
|
const h = this.#filenameToHash.get(filename);
|
|
2402
2403
|
if (h && index.has(h)) {
|
|
2403
2404
|
index.delete(h);
|
|
2404
|
-
|
|
2405
|
-
this.emit("certificateRemoved", { store, fingerprint: h, filename });
|
|
2406
|
-
}
|
|
2405
|
+
this.emit("certificateRemoved", { store, fingerprint: h, filename });
|
|
2407
2406
|
}
|
|
2408
2407
|
});
|
|
2409
2408
|
w.on("add", (filename) => {
|
|
@@ -2412,6 +2411,7 @@ var CertificateManager = class _CertificateManager extends import_node_events.Ev
|
|
|
2412
2411
|
const certificate = (0, import_node_opcua_crypto5.readCertificate)(filename);
|
|
2413
2412
|
const info = (0, import_node_opcua_crypto5.exploreCertificate)(certificate);
|
|
2414
2413
|
const fingerprint = makeFingerprint(certificate);
|
|
2414
|
+
const isNew = !index.has(fingerprint);
|
|
2415
2415
|
index.set(fingerprint, { certificate, filename, info });
|
|
2416
2416
|
this.#filenameToHash.set(filename, fingerprint);
|
|
2417
2417
|
debugLog(
|
|
@@ -2420,7 +2420,7 @@ var CertificateManager = class _CertificateManager extends import_node_events.Ev
|
|
|
2420
2420
|
info.tbsCertificate.serialNumber,
|
|
2421
2421
|
info.tbsCertificate.extensions?.authorityKeyIdentifier?.authorityCertIssuerFingerPrint
|
|
2422
2422
|
);
|
|
2423
|
-
if (ready) {
|
|
2423
|
+
if (ready || isNew) {
|
|
2424
2424
|
this.emit("certificateAdded", { store, certificate, fingerprint, filename });
|
|
2425
2425
|
}
|
|
2426
2426
|
} catch (err) {
|
|
@@ -2439,9 +2439,7 @@ var CertificateManager = class _CertificateManager extends import_node_events.Ev
|
|
|
2439
2439
|
}
|
|
2440
2440
|
index.set(newFingerprint, { certificate, filename: changedPath, info: (0, import_node_opcua_crypto5.exploreCertificate)(certificate) });
|
|
2441
2441
|
this.#filenameToHash.set(changedPath, newFingerprint);
|
|
2442
|
-
|
|
2443
|
-
this.emit("certificateChange", { store, certificate, fingerprint: newFingerprint, filename: changedPath });
|
|
2444
|
-
}
|
|
2442
|
+
this.emit("certificateChange", { store, certificate, fingerprint: newFingerprint, filename: changedPath });
|
|
2445
2443
|
} catch (err) {
|
|
2446
2444
|
debugLog(`change event: failed to re-read ${changedPath}`, err);
|
|
2447
2445
|
}
|