node-opcua-server-configuration 2.75.0 → 2.76.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.
Files changed (36) hide show
  1. package/dist/clientTools/index.d.ts +1 -1
  2. package/dist/clientTools/index.js +17 -17
  3. package/dist/clientTools/push_certificate_management_client.d.ts +176 -176
  4. package/dist/clientTools/push_certificate_management_client.js +463 -463
  5. package/dist/index.d.ts +10 -10
  6. package/dist/index.js +27 -27
  7. package/dist/push_certificate_manager.d.ts +141 -141
  8. package/dist/push_certificate_manager.js +2 -2
  9. package/dist/server/install_certificate_file_watcher.d.ts +5 -5
  10. package/dist/server/install_certificate_file_watcher.js +23 -23
  11. package/dist/server/install_push_certitifate_management.d.ts +19 -19
  12. package/dist/server/install_push_certitifate_management.js +213 -213
  13. package/dist/server/promote_trust_list.d.ts +6 -6
  14. package/dist/server/promote_trust_list.js +175 -175
  15. package/dist/server/push_certificate_manager_helpers.d.ts +4 -4
  16. package/dist/server/push_certificate_manager_helpers.js +410 -409
  17. package/dist/server/push_certificate_manager_helpers.js.map +1 -1
  18. package/dist/server/push_certificate_manager_server_impl.d.ts +49 -49
  19. package/dist/server/push_certificate_manager_server_impl.js +522 -522
  20. package/dist/server/roles_and_permissions.d.ts +3 -3
  21. package/dist/server/roles_and_permissions.js +40 -40
  22. package/dist/server/tools.d.ts +3 -3
  23. package/dist/server/tools.js +19 -19
  24. package/dist/server/trust_list_server.d.ts +13 -13
  25. package/dist/server/trust_list_server.js +89 -89
  26. package/dist/standard_certificate_types.d.ts +6 -6
  27. package/dist/standard_certificate_types.js +13 -13
  28. package/dist/trust_list.d.ts +79 -79
  29. package/dist/trust_list.js +2 -2
  30. package/dist/trust_list_impl.js +25 -25
  31. package/package.json +27 -27
  32. package/source/server/push_certificate_manager_helpers.ts +3 -3
  33. package/dist/server/install_CertificateAlarm.d.ts +0 -11
  34. package/dist/server/install_CertificateAlarm.js +0 -46
  35. package/dist/server/install_CertificateAlarm.js.map +0 -1
  36. package/source/server/install_CertificateAlarm.ts +0 -56
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- /**
2
- * @module node-opcua-server-configuration
3
- */
4
- export * from "./push_certificate_manager";
5
- export * from "./clientTools/push_certificate_management_client";
6
- export * from "./standard_certificate_types";
7
- export * from "./server/install_push_certitifate_management";
8
- export * from "./server/push_certificate_manager_server_impl";
9
- export * from "./server/push_certificate_manager_helpers";
10
- export * from "./server/promote_trust_list";
1
+ /**
2
+ * @module node-opcua-server-configuration
3
+ */
4
+ export * from "./push_certificate_manager";
5
+ export * from "./clientTools/push_certificate_management_client";
6
+ export * from "./standard_certificate_types";
7
+ export * from "./server/install_push_certitifate_management";
8
+ export * from "./server/push_certificate_manager_server_impl";
9
+ export * from "./server/push_certificate_manager_helpers";
10
+ export * from "./server/promote_trust_list";
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * @module node-opcua-server-configuration
19
- */
20
- // export * from "./trust_list_impl";
21
- __exportStar(require("./push_certificate_manager"), exports);
22
- __exportStar(require("./clientTools/push_certificate_management_client"), exports);
23
- __exportStar(require("./standard_certificate_types"), exports);
24
- __exportStar(require("./server/install_push_certitifate_management"), exports);
25
- __exportStar(require("./server/push_certificate_manager_server_impl"), exports);
26
- __exportStar(require("./server/push_certificate_manager_helpers"), exports);
27
- __exportStar(require("./server/promote_trust_list"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * @module node-opcua-server-configuration
19
+ */
20
+ // export * from "./trust_list_impl";
21
+ __exportStar(require("./push_certificate_manager"), exports);
22
+ __exportStar(require("./clientTools/push_certificate_management_client"), exports);
23
+ __exportStar(require("./standard_certificate_types"), exports);
24
+ __exportStar(require("./server/install_push_certitifate_management"), exports);
25
+ __exportStar(require("./server/push_certificate_manager_server_impl"), exports);
26
+ __exportStar(require("./server/push_certificate_manager_helpers"), exports);
27
+ __exportStar(require("./server/promote_trust_list"), exports);
28
28
  //# sourceMappingURL=index.js.map
@@ -1,141 +1,141 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-server-configuration
4
- */
5
- import { ByteString, UAString } from "node-opcua-basic-types";
6
- import { NodeId } from "node-opcua-nodeid";
7
- import { StatusCode } from "node-opcua-status-code";
8
- export interface CreateSigningRequestResult {
9
- statusCode: StatusCode;
10
- certificateSigningRequest?: Buffer;
11
- }
12
- export interface GetRejectedListResult {
13
- statusCode: StatusCode;
14
- certificates?: Buffer[];
15
- }
16
- export interface UpdateCertificateResult {
17
- statusCode: StatusCode;
18
- applyChangesRequired?: boolean;
19
- }
20
- export interface PushCertificateManager {
21
- /**
22
- * The SupportedPrivateKeyFormats specifies the PrivateKey formats supported by the Server.
23
- * Possible values include “PEM” (see RFC 5958) or “PFX” (see PKCS #12). The array is empty
24
- * if the Server does not allow external Clients to update the PrivateKey
25
- */
26
- getSupportedPrivateKeyFormats(): Promise<string[]>;
27
- /**
28
- * UpdateCertificate is used to update a Certificate for a Server.
29
- * There are the following three use cases for this Method:
30
- * • The new Certificate was created based on a signing request created with the Method
31
- * CreateSigningRequest defined in 7.7.6. In this case there is no privateKey provided.
32
- * • A new privateKey and Certificate was created outside the Server and both are updated
33
- * with this Method.
34
- * • A new Certificate was created and signed with the information from the old Certificate.
35
- * In this case there is no privateKey provided.
36
- * The Server shall do all normal integrity checks on the Certificate and all of the issuer
37
- * Certificates. If errors occur the Bad_SecurityChecksFailed error is returned.
38
- * The Server shall report an error if the public key does not match the existing Certificate and
39
- * the privateKey was not provided.
40
- *
41
- * @param certificateGroupId - The NodeId of the Certificate Group Object which is affected by the update.
42
- * If null the DefaultApplicationGroup is used.
43
- * @param certificateTypeId - The type of Certificate being updated. The set of permitted types is specified by
44
- * the CertificateTypes Property belonging to the Certificate Group.
45
- * @param certificate - The DER encoded Certificate which replaces the existing Certificate
46
- * @param issuerCertificates - The issuer Certificates needed to verify the signature on the new Certificate
47
- * @param privateKeyFormat - The format of the Private Key (PEM or PFX). If the privateKey is not specified
48
- * the privateKeyFormat is null or empty
49
- * @param privateKey - the Private Key encoded in the privateKeyFormat.
50
- * @return applyChangesRequired - Indicates that the ApplyChanges Method shall be called before the new
51
- * Certificate will be used.
52
- *
53
- *
54
- * Result Code Description
55
- * BadInvalidArgument The certificateTypeId or certificateGroupId is not valid.
56
- * BadCertificateInvalid The Certificate is invalid or the format is not supported.
57
- * BadNotSupported The PrivateKey is invalid or the format is not supported.
58
- * BadUserAccessDenied The current user does not have the rights required.
59
- * BadSecurityChecksFailed Some failure occurred verifying the integrity of the Certificate.
60
- *
61
- */
62
- updateCertificate(certificateGroupId: NodeId | string, certificateTypeId: NodeId | string, certificate: ByteString, issuerCertificates: ByteString[], privateKeyFormat: UAString, privateKey: ByteString): Promise<UpdateCertificateResult>;
63
- /**
64
- * The ApplyChanges Method is used to apply any security related changes if the Server sets
65
- * the applyChangesRequired flag when another Method is called. Servers should minimize the
66
- * impact of applying the new configuration, however, it could require that all existing Sessions
67
- * be closed and re-opened by the Clients.
68
- *
69
- *
70
- * ApplyChanges is used to tell the Server to apply any security changes.
71
- * This Method should only be called if a previous call to a Method that changed the
72
- * configuration returns applyChangesRequired=true (see 7.7.4).
73
- * If the Server Certificate has changed, Secure Channels using the old Certificate will
74
- * eventually be interrupted. The only leeway the Server has is with the timing. In the best case,
75
- * the Server can close the TransportConnections for the affected Endpoints and leave any
76
- * Subscriptions intact. This should appear no different than a network interruption from the
77
- * perspective of the Client. The Client should be prepared to deal with Certificate changes
78
- * during its reconnect logic. In the worst case, a full shutdown which affects all connected
79
- * Clients will be necessary. In the latter case, the Server shall advertise its intent to interrupt
80
- * connections by setting the SecondsTillShutdown and ShutdownReason Properties in the
81
- * ServerStatus Variable.
82
- *
83
- * If the Secure Channel being used to call this Method will be affected by the Certificate change
84
- * then the Server shall introduce a delay long enough to allow the caller to receive a reply.
85
- * This Method requires an encrypted channel and that the Client provide credentials with
86
- * administrative rights on the Server.
87
- *
88
- *
89
- * Result Code Description
90
- * Bad_UserAccessDenied The current user does not have the rights required.
91
- */
92
- applyChanges(): Promise<StatusCode>;
93
- /**
94
- * The CreateSigningRequest Method asks the Server to create a PKCS #10 encoded Certificate
95
- * Request that is signed with the Server’s private key.
96
- *
97
- * CreateSigningRequest Method asks the Server to create a PKCS #10 DER encoded
98
- * Certificate Request that is signed with the Server’s private key. This request can be then used
99
- * to request a Certificate from a CA that expects requests in this format.
100
- * This Method requires an encrypted channel and that the Client provide credentials with
101
- * administrative rights on the Server.
102
- *
103
- * @param certificateGroupId - The NodeId of the Certificate Group Object which is affected by the request.
104
- * If null the DefaultApplicationGroup is used.
105
- * @param certificateTypeId - The type of Certificate being requested. The set of permitted types is specified by
106
- * the CertificateTypes Property belonging to the Certificate Group.
107
- * @param subjectName - The subject name to use in the Certificate Request.
108
- * If not specified the SubjectName from the current Certificate is used.
109
- * The format of the subjectName is defined in 7.6.4
110
- * @param regeneratePrivateKey - If TRUE the Server shall create a new Private Key which it stores until the
111
- * matching signed Certificate is uploaded with the UpdateCertificate Method.
112
- * Previously created Private Keys may be discarded if UpdateCertificate was not
113
- * called before calling this method again. If FALSE the Server uses its existing
114
- * Private Key.
115
- * @param nonce - Additional entropy which the caller shall provide if regeneratePrivateKey is TRUE.
116
- * It shall be at least 32 bytes long
117
- * @return certificateRequest - The PKCS #10 DER encoded Certificate Request.
118
- *
119
- *
120
- * Result Code Description
121
- * Bad_InvalidArgument The certificateTypeId, certificateGroupId or subjectName is not valid.
122
- * Bad_UserAccessDenied The current user does not have the rights required.
123
- */
124
- createSigningRequest(certificateGroupId: NodeId | string, certificateTypeId: NodeId | string, subjectName: string | null, regeneratePrivateKey?: boolean, nonce?: ByteString): Promise<CreateSigningRequestResult>;
125
- /**
126
- * GetRejectedList Method returns the list of Certificates that have been rejected by the Server.
127
- * No rules are defined for how the Server updates this list or how long a Certificate is kept in
128
- * the list. It is recommended that every valid but untrusted Certificate be added to the rejected
129
- * list as long as storage is available. Servers should omit older entries from the list returned if
130
- * the maximum message size is not large enough to allow the entire list to be returned.
131
- * This Method requires an encrypted channel and that the Client provides credentials with
132
- * administrative rights on the Server.
133
- *
134
- * Argument Description
135
- * certificates out - The DER encoded form of the Certificates rejected by the Server.
136
- *
137
- * Result Code Description
138
- * Bad_UserAccessDenied The current user does not have the rights required
139
- */
140
- getRejectedList(): Promise</*certificates*/ GetRejectedListResult>;
141
- }
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-server-configuration
4
+ */
5
+ import { ByteString, UAString } from "node-opcua-basic-types";
6
+ import { NodeId } from "node-opcua-nodeid";
7
+ import { StatusCode } from "node-opcua-status-code";
8
+ export interface CreateSigningRequestResult {
9
+ statusCode: StatusCode;
10
+ certificateSigningRequest?: Buffer;
11
+ }
12
+ export interface GetRejectedListResult {
13
+ statusCode: StatusCode;
14
+ certificates?: Buffer[];
15
+ }
16
+ export interface UpdateCertificateResult {
17
+ statusCode: StatusCode;
18
+ applyChangesRequired?: boolean;
19
+ }
20
+ export interface PushCertificateManager {
21
+ /**
22
+ * The SupportedPrivateKeyFormats specifies the PrivateKey formats supported by the Server.
23
+ * Possible values include “PEM” (see RFC 5958) or “PFX” (see PKCS #12). The array is empty
24
+ * if the Server does not allow external Clients to update the PrivateKey
25
+ */
26
+ getSupportedPrivateKeyFormats(): Promise<string[]>;
27
+ /**
28
+ * UpdateCertificate is used to update a Certificate for a Server.
29
+ * There are the following three use cases for this Method:
30
+ * • The new Certificate was created based on a signing request created with the Method
31
+ * CreateSigningRequest defined in 7.7.6. In this case there is no privateKey provided.
32
+ * • A new privateKey and Certificate was created outside the Server and both are updated
33
+ * with this Method.
34
+ * • A new Certificate was created and signed with the information from the old Certificate.
35
+ * In this case there is no privateKey provided.
36
+ * The Server shall do all normal integrity checks on the Certificate and all of the issuer
37
+ * Certificates. If errors occur the Bad_SecurityChecksFailed error is returned.
38
+ * The Server shall report an error if the public key does not match the existing Certificate and
39
+ * the privateKey was not provided.
40
+ *
41
+ * @param certificateGroupId - The NodeId of the Certificate Group Object which is affected by the update.
42
+ * If null the DefaultApplicationGroup is used.
43
+ * @param certificateTypeId - The type of Certificate being updated. The set of permitted types is specified by
44
+ * the CertificateTypes Property belonging to the Certificate Group.
45
+ * @param certificate - The DER encoded Certificate which replaces the existing Certificate
46
+ * @param issuerCertificates - The issuer Certificates needed to verify the signature on the new Certificate
47
+ * @param privateKeyFormat - The format of the Private Key (PEM or PFX). If the privateKey is not specified
48
+ * the privateKeyFormat is null or empty
49
+ * @param privateKey - the Private Key encoded in the privateKeyFormat.
50
+ * @return applyChangesRequired - Indicates that the ApplyChanges Method shall be called before the new
51
+ * Certificate will be used.
52
+ *
53
+ *
54
+ * Result Code Description
55
+ * BadInvalidArgument The certificateTypeId or certificateGroupId is not valid.
56
+ * BadCertificateInvalid The Certificate is invalid or the format is not supported.
57
+ * BadNotSupported The PrivateKey is invalid or the format is not supported.
58
+ * BadUserAccessDenied The current user does not have the rights required.
59
+ * BadSecurityChecksFailed Some failure occurred verifying the integrity of the Certificate.
60
+ *
61
+ */
62
+ updateCertificate(certificateGroupId: NodeId | string, certificateTypeId: NodeId | string, certificate: ByteString, issuerCertificates: ByteString[], privateKeyFormat: UAString, privateKey: ByteString): Promise<UpdateCertificateResult>;
63
+ /**
64
+ * The ApplyChanges Method is used to apply any security related changes if the Server sets
65
+ * the applyChangesRequired flag when another Method is called. Servers should minimize the
66
+ * impact of applying the new configuration, however, it could require that all existing Sessions
67
+ * be closed and re-opened by the Clients.
68
+ *
69
+ *
70
+ * ApplyChanges is used to tell the Server to apply any security changes.
71
+ * This Method should only be called if a previous call to a Method that changed the
72
+ * configuration returns applyChangesRequired=true (see 7.7.4).
73
+ * If the Server Certificate has changed, Secure Channels using the old Certificate will
74
+ * eventually be interrupted. The only leeway the Server has is with the timing. In the best case,
75
+ * the Server can close the TransportConnections for the affected Endpoints and leave any
76
+ * Subscriptions intact. This should appear no different than a network interruption from the
77
+ * perspective of the Client. The Client should be prepared to deal with Certificate changes
78
+ * during its reconnect logic. In the worst case, a full shutdown which affects all connected
79
+ * Clients will be necessary. In the latter case, the Server shall advertise its intent to interrupt
80
+ * connections by setting the SecondsTillShutdown and ShutdownReason Properties in the
81
+ * ServerStatus Variable.
82
+ *
83
+ * If the Secure Channel being used to call this Method will be affected by the Certificate change
84
+ * then the Server shall introduce a delay long enough to allow the caller to receive a reply.
85
+ * This Method requires an encrypted channel and that the Client provide credentials with
86
+ * administrative rights on the Server.
87
+ *
88
+ *
89
+ * Result Code Description
90
+ * Bad_UserAccessDenied The current user does not have the rights required.
91
+ */
92
+ applyChanges(): Promise<StatusCode>;
93
+ /**
94
+ * The CreateSigningRequest Method asks the Server to create a PKCS #10 encoded Certificate
95
+ * Request that is signed with the Server’s private key.
96
+ *
97
+ * CreateSigningRequest Method asks the Server to create a PKCS #10 DER encoded
98
+ * Certificate Request that is signed with the Server’s private key. This request can be then used
99
+ * to request a Certificate from a CA that expects requests in this format.
100
+ * This Method requires an encrypted channel and that the Client provide credentials with
101
+ * administrative rights on the Server.
102
+ *
103
+ * @param certificateGroupId - The NodeId of the Certificate Group Object which is affected by the request.
104
+ * If null the DefaultApplicationGroup is used.
105
+ * @param certificateTypeId - The type of Certificate being requested. The set of permitted types is specified by
106
+ * the CertificateTypes Property belonging to the Certificate Group.
107
+ * @param subjectName - The subject name to use in the Certificate Request.
108
+ * If not specified the SubjectName from the current Certificate is used.
109
+ * The format of the subjectName is defined in 7.6.4
110
+ * @param regeneratePrivateKey - If TRUE the Server shall create a new Private Key which it stores until the
111
+ * matching signed Certificate is uploaded with the UpdateCertificate Method.
112
+ * Previously created Private Keys may be discarded if UpdateCertificate was not
113
+ * called before calling this method again. If FALSE the Server uses its existing
114
+ * Private Key.
115
+ * @param nonce - Additional entropy which the caller shall provide if regeneratePrivateKey is TRUE.
116
+ * It shall be at least 32 bytes long
117
+ * @return certificateRequest - The PKCS #10 DER encoded Certificate Request.
118
+ *
119
+ *
120
+ * Result Code Description
121
+ * Bad_InvalidArgument The certificateTypeId, certificateGroupId or subjectName is not valid.
122
+ * Bad_UserAccessDenied The current user does not have the rights required.
123
+ */
124
+ createSigningRequest(certificateGroupId: NodeId | string, certificateTypeId: NodeId | string, subjectName: string | null, regeneratePrivateKey?: boolean, nonce?: ByteString): Promise<CreateSigningRequestResult>;
125
+ /**
126
+ * GetRejectedList Method returns the list of Certificates that have been rejected by the Server.
127
+ * No rules are defined for how the Server updates this list or how long a Certificate is kept in
128
+ * the list. It is recommended that every valid but untrusted Certificate be added to the rejected
129
+ * list as long as storage is available. Servers should omit older entries from the list returned if
130
+ * the maximum message size is not large enough to allow the entire list to be returned.
131
+ * This Method requires an encrypted channel and that the Client provides credentials with
132
+ * administrative rights on the Server.
133
+ *
134
+ * Argument Description
135
+ * certificates out - The DER encoded form of the Certificates rejected by the Server.
136
+ *
137
+ * Result Code Description
138
+ * Bad_UserAccessDenied The current user does not have the rights required
139
+ */
140
+ getRejectedList(): Promise</*certificates*/ GetRejectedListResult>;
141
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=push_certificate_manager.js.map
@@ -1,5 +1,5 @@
1
- import { UAObject } from "node-opcua-address-space-base";
2
- export interface ChangeDetector {
3
- on(eventName: "certificateChange", handler: () => void): this;
4
- }
5
- export declare function installCertificateFileWatcher(node: UAObject, certificateFile: string): ChangeDetector;
1
+ import { UAObject } from "node-opcua-address-space-base";
2
+ export interface ChangeDetector {
3
+ on(eventName: "certificateChange", handler: () => void): this;
4
+ }
5
+ export declare function installCertificateFileWatcher(node: UAObject, certificateFile: string): ChangeDetector;
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installCertificateFileWatcher = void 0;
4
- const fs = require("fs");
5
- const path = require("path");
6
- const node_opcua_debug_1 = require("node-opcua-debug");
7
- const debugLog = (0, node_opcua_debug_1.make_debugLog)("ServerConfiguration");
8
- function installCertificateFileWatcher(node, certificateFile) {
9
- const fileToWatch = path.basename(certificateFile);
10
- const fsWatcher = fs.watch(path.dirname(certificateFile), { persistent: false }, (eventType, filename) => {
11
- /** */
12
- if (filename === fileToWatch) {
13
- debugLog("filename changed = ", filename, fileToWatch);
14
- node.emit("certificateChange");
15
- }
16
- });
17
- const addressSpace = node.addressSpace;
18
- addressSpace.registerShutdownTask(() => {
19
- fsWatcher.close();
20
- });
21
- return node;
22
- }
23
- exports.installCertificateFileWatcher = installCertificateFileWatcher;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installCertificateFileWatcher = void 0;
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const node_opcua_debug_1 = require("node-opcua-debug");
7
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)("ServerConfiguration");
8
+ function installCertificateFileWatcher(node, certificateFile) {
9
+ const fileToWatch = path.basename(certificateFile);
10
+ const fsWatcher = fs.watch(path.dirname(certificateFile), { persistent: false }, (eventType, filename) => {
11
+ /** */
12
+ if (filename === fileToWatch) {
13
+ debugLog("filename changed = ", filename, fileToWatch);
14
+ node.emit("certificateChange");
15
+ }
16
+ });
17
+ const addressSpace = node.addressSpace;
18
+ addressSpace.registerShutdownTask(() => {
19
+ fsWatcher.close();
20
+ });
21
+ return node;
22
+ }
23
+ exports.installCertificateFileWatcher = installCertificateFileWatcher;
24
24
  //# sourceMappingURL=install_certificate_file_watcher.js.map
@@ -1,19 +1,19 @@
1
- import { AddressSpace } from "node-opcua-address-space";
2
- import { OPCUACertificateManager } from "node-opcua-certificate-manager";
3
- import { Certificate, PrivateKeyPEM } from "node-opcua-crypto";
4
- import { ICertificateKeyPairProviderPriv } from "node-opcua-common";
5
- import { OPCUAServer } from "node-opcua-server";
6
- import { ApplicationDescriptionOptions } from "node-opcua-types";
7
- export interface OPCUAServerPartial extends ICertificateKeyPairProviderPriv {
8
- serverInfo?: ApplicationDescriptionOptions;
9
- serverCertificateManager: OPCUACertificateManager;
10
- privateKeyFile: string;
11
- certificateFile: string;
12
- $$certificate: null | Certificate;
13
- $$certificateChain: null | Certificate;
14
- $$privateKeyPEM: null | PrivateKeyPEM;
15
- engine: {
16
- addressSpace?: AddressSpace;
17
- };
18
- }
19
- export declare function installPushCertificateManagementOnServer(server: OPCUAServer): Promise<void>;
1
+ import { AddressSpace } from "node-opcua-address-space";
2
+ import { OPCUACertificateManager } from "node-opcua-certificate-manager";
3
+ import { Certificate, PrivateKeyPEM } from "node-opcua-crypto";
4
+ import { ICertificateKeyPairProviderPriv } from "node-opcua-common";
5
+ import { OPCUAServer } from "node-opcua-server";
6
+ import { ApplicationDescriptionOptions } from "node-opcua-types";
7
+ export interface OPCUAServerPartial extends ICertificateKeyPairProviderPriv {
8
+ serverInfo?: ApplicationDescriptionOptions;
9
+ serverCertificateManager: OPCUACertificateManager;
10
+ privateKeyFile: string;
11
+ certificateFile: string;
12
+ $$certificate: null | Certificate;
13
+ $$certificateChain: null | Certificate;
14
+ $$privateKeyPEM: null | PrivateKeyPEM;
15
+ engine: {
16
+ addressSpace?: AddressSpace;
17
+ };
18
+ }
19
+ export declare function installPushCertificateManagementOnServer(server: OPCUAServer): Promise<void>;