node-opcua-server-configuration 2.113.0 → 2.114.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.
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ClientPushCertificateManagement = exports.CertificateGroup = exports.TrustListClient = void 0;
13
4
  const node_opcua_nodeid_1 = require("node-opcua-nodeid");
@@ -60,151 +51,130 @@ class TrustListClient extends node_opcua_file_transfer_1.ClientFile {
60
51
  /**
61
52
  * @private
62
53
  */
63
- _extractMethodIds() {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const browseResults = yield this.session.translateBrowsePath([
66
- (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CloseAndUpdate"),
67
- (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/AddCertificate"),
68
- (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/RemoveCertificate"),
69
- (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/OpenWithMasks") // OpenWithMasks Mandatory
70
- ]);
71
- this.closeAndUpdateNodeId = browseResults[0].targets[0].targetId;
72
- this.addCertificateNodeId = browseResults[1].targets[0].targetId;
73
- this.removeCertificateNodeId = browseResults[2].targets[0].targetId;
74
- this.openWithMasksNodeId = browseResults[3].targets[0].targetId;
75
- // istanbul ignore next
76
- if (!this.openWithMasksNodeId || this.openWithMasksNodeId.isEmpty()) {
77
- throw new Error("Cannot find mandatory method OpenWithMask on object");
78
- }
79
- });
54
+ async _extractMethodIds() {
55
+ const browseResults = await this.session.translateBrowsePath([
56
+ (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CloseAndUpdate"),
57
+ (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/AddCertificate"),
58
+ (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/RemoveCertificate"),
59
+ (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/OpenWithMasks") // OpenWithMasks Mandatory
60
+ ]);
61
+ this.closeAndUpdateNodeId = browseResults[0].targets[0].targetId;
62
+ this.addCertificateNodeId = browseResults[1].targets[0].targetId;
63
+ this.removeCertificateNodeId = browseResults[2].targets[0].targetId;
64
+ this.openWithMasksNodeId = browseResults[3].targets[0].targetId;
65
+ // istanbul ignore next
66
+ if (!this.openWithMasksNodeId || this.openWithMasksNodeId.isEmpty()) {
67
+ throw new Error("Cannot find mandatory method OpenWithMask on object");
68
+ }
80
69
  }
81
- extractMethodsIds() {
82
- const _super = Object.create(null, {
83
- extractMethodsIds: { get: () => super.extractMethodsIds }
84
- });
85
- return __awaiter(this, void 0, void 0, function* () {
86
- yield _super.extractMethodsIds.call(this);
87
- yield this._extractMethodIds();
88
- });
70
+ async extractMethodsIds() {
71
+ await super.extractMethodsIds();
72
+ await this._extractMethodIds();
89
73
  }
90
- openWithMasks(trustListMask) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- // istanbul ignore next
93
- if (this.fileHandle) {
94
- throw new Error("File has already be opened");
95
- }
96
- yield this.ensureInitialized();
97
- // istanbul ignore next
98
- if (!this.openWithMasksNodeId) {
99
- throw new Error("OpenWithMasks doesn't exist");
100
- }
101
- const inputArguments = [{ dataType: node_opcua_variant_1.DataType.UInt32, value: trustListMask }];
102
- const methodToCall = {
103
- inputArguments,
104
- methodId: this.openWithMasksNodeId,
105
- objectId: this.nodeId
106
- };
107
- const callMethodResult = yield this.session.call(methodToCall);
108
- if (callMethodResult.statusCode.isNotGood()) {
109
- throw new Error(callMethodResult.statusCode.name);
110
- }
111
- this.fileHandle = callMethodResult.outputArguments[0].value;
112
- return this.fileHandle;
113
- });
74
+ async openWithMasks(trustListMask) {
75
+ // istanbul ignore next
76
+ if (this.fileHandle) {
77
+ throw new Error("File has already be opened");
78
+ }
79
+ await this.ensureInitialized();
80
+ // istanbul ignore next
81
+ if (!this.openWithMasksNodeId) {
82
+ throw new Error("OpenWithMasks doesn't exist");
83
+ }
84
+ const inputArguments = [{ dataType: node_opcua_variant_1.DataType.UInt32, value: trustListMask }];
85
+ const methodToCall = {
86
+ inputArguments,
87
+ methodId: this.openWithMasksNodeId,
88
+ objectId: this.nodeId
89
+ };
90
+ const callMethodResult = await this.session.call(methodToCall);
91
+ if (callMethodResult.statusCode.isNotGood()) {
92
+ throw new Error(callMethodResult.statusCode.name);
93
+ }
94
+ this.fileHandle = callMethodResult.outputArguments[0].value;
95
+ return this.fileHandle;
114
96
  }
115
- closeAndUpdate(applyChangesRequired) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- if (!this.fileHandle) {
118
- throw new Error("File has node been opened yet");
119
- }
120
- yield this.ensureInitialized();
121
- if (!this.closeAndUpdateNodeId) {
122
- throw new Error("CloseAndUpdateMethod doesn't exist");
123
- }
124
- const inputArguments = [
125
- { dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
126
- { dataType: node_opcua_variant_1.DataType.Boolean, value: !!applyChangesRequired }
127
- ];
128
- const methodToCall = {
129
- inputArguments,
130
- methodId: this.closeAndUpdateNodeId,
131
- objectId: this.nodeId
132
- };
133
- const callMethodResult = yield this.session.call(methodToCall);
134
- if (callMethodResult.statusCode.isNotGood()) {
135
- throw new Error(callMethodResult.statusCode.name);
136
- }
137
- return callMethodResult.outputArguments[0].value;
138
- });
97
+ async closeAndUpdate(applyChangesRequired) {
98
+ if (!this.fileHandle) {
99
+ throw new Error("File has node been opened yet");
100
+ }
101
+ await this.ensureInitialized();
102
+ if (!this.closeAndUpdateNodeId) {
103
+ throw new Error("CloseAndUpdateMethod doesn't exist");
104
+ }
105
+ const inputArguments = [
106
+ { dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
107
+ { dataType: node_opcua_variant_1.DataType.Boolean, value: !!applyChangesRequired }
108
+ ];
109
+ const methodToCall = {
110
+ inputArguments,
111
+ methodId: this.closeAndUpdateNodeId,
112
+ objectId: this.nodeId
113
+ };
114
+ const callMethodResult = await this.session.call(methodToCall);
115
+ if (callMethodResult.statusCode.isNotGood()) {
116
+ throw new Error(callMethodResult.statusCode.name);
117
+ }
118
+ return callMethodResult.outputArguments[0].value;
139
119
  }
140
- addCertificate(certificate, isTrustedCertificate) {
141
- return __awaiter(this, void 0, void 0, function* () {
142
- yield this.ensureInitialized();
143
- const inputArguments = [
144
- { dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
145
- { dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
146
- ];
147
- const methodToCall = {
148
- inputArguments,
149
- methodId: this.addCertificateNodeId,
150
- objectId: this.nodeId
151
- };
152
- const callMethodResult = yield this.session.call(methodToCall);
153
- return callMethodResult.statusCode;
154
- });
120
+ async addCertificate(certificate, isTrustedCertificate) {
121
+ await this.ensureInitialized();
122
+ const inputArguments = [
123
+ { dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
124
+ { dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
125
+ ];
126
+ const methodToCall = {
127
+ inputArguments,
128
+ methodId: this.addCertificateNodeId,
129
+ objectId: this.nodeId
130
+ };
131
+ const callMethodResult = await this.session.call(methodToCall);
132
+ return callMethodResult.statusCode;
155
133
  }
156
- removeCertificate(thumbprint, isTrustedCertificate) {
157
- return __awaiter(this, void 0, void 0, function* () {
158
- yield this.ensureInitialized();
159
- const inputArguments = [
160
- { dataType: node_opcua_variant_1.DataType.String, value: thumbprint },
161
- { dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
162
- ];
163
- const methodToCall = {
164
- inputArguments,
165
- methodId: this.removeCertificateNodeId,
166
- objectId: this.nodeId
167
- };
168
- const callMethodResult = yield this.session.call(methodToCall);
169
- return callMethodResult.statusCode;
170
- });
134
+ async removeCertificate(thumbprint, isTrustedCertificate) {
135
+ await this.ensureInitialized();
136
+ const inputArguments = [
137
+ { dataType: node_opcua_variant_1.DataType.String, value: thumbprint },
138
+ { dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
139
+ ];
140
+ const methodToCall = {
141
+ inputArguments,
142
+ methodId: this.removeCertificateNodeId,
143
+ objectId: this.nodeId
144
+ };
145
+ const callMethodResult = await this.session.call(methodToCall);
146
+ return callMethodResult.statusCode;
171
147
  }
172
148
  /**
173
149
  * helper function to retrieve the list of certificates ...
174
150
  * @returns
175
151
  */
176
- readTrustedCertificateList() {
177
- return __awaiter(this, void 0, void 0, function* () {
178
- // const size = await this.size();
179
- const fileHandle = yield this.open(node_opcua_file_transfer_1.OpenFileMode.Read);
180
- const buff = yield this.read(65525);
181
- yield this.close();
182
- const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
183
- const trustList = new node_opcua_types_1.TrustListDataType();
184
- trustList.decode(stream);
185
- return trustList;
186
- });
152
+ async readTrustedCertificateList() {
153
+ // const size = await this.size();
154
+ const fileHandle = await this.open(node_opcua_file_transfer_1.OpenFileMode.Read);
155
+ const buff = await this.read(65525);
156
+ await this.close();
157
+ const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
158
+ const trustList = new node_opcua_types_1.TrustListDataType();
159
+ trustList.decode(stream);
160
+ return trustList;
187
161
  }
188
- readTrustedCertificateListWithMasks(trustListMask) {
189
- return __awaiter(this, void 0, void 0, function* () {
190
- // const size = await this.size();
191
- const fileHandle = yield this.openWithMasks(trustListMask);
192
- const buff = yield this.read(65525);
193
- yield this.close();
194
- const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
195
- const trustList = new node_opcua_types_1.TrustListDataType();
196
- trustList.decode(stream);
197
- return trustList;
198
- });
162
+ async readTrustedCertificateListWithMasks(trustListMask) {
163
+ // const size = await this.size();
164
+ const fileHandle = await this.openWithMasks(trustListMask);
165
+ const buff = await this.read(65525);
166
+ await this.close();
167
+ const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
168
+ const trustList = new node_opcua_types_1.TrustListDataType();
169
+ trustList.decode(stream);
170
+ return trustList;
199
171
  }
200
- writeTrustedCertificateList(trustedList) {
201
- return __awaiter(this, void 0, void 0, function* () {
202
- yield this.open(node_opcua_file_transfer_1.OpenFileMode.Write);
203
- const s = trustedList.binaryStoreSize();
204
- const stream = new node_opcua_binary_stream_1.BinaryStream(s);
205
- trustedList.encode(stream);
206
- return yield this.closeAndUpdate(true);
207
- });
172
+ async writeTrustedCertificateList(trustedList) {
173
+ await this.open(node_opcua_file_transfer_1.OpenFileMode.Write);
174
+ const s = trustedList.binaryStoreSize();
175
+ const stream = new node_opcua_binary_stream_1.BinaryStream(s);
176
+ trustedList.encode(stream);
177
+ return await this.closeAndUpdate(true);
208
178
  }
209
179
  }
210
180
  exports.TrustListClient = TrustListClient;
@@ -213,29 +183,25 @@ class CertificateGroup {
213
183
  this.session = session;
214
184
  this.nodeId = nodeId;
215
185
  }
216
- getCertificateTypes() {
217
- return __awaiter(this, void 0, void 0, function* () {
218
- const browsePathResult = yield this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CertificateTypes"));
219
- if (browsePathResult.statusCode.isNotGood()) {
220
- throw new Error(browsePathResult.statusCode.name);
221
- }
222
- const certificateTypesNodeId = browsePathResult.targets[0].targetId;
223
- const dataValue = yield this.session.read({ nodeId: certificateTypesNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value });
224
- if (dataValue.statusCode.isNotGood()) {
225
- throw new Error(browsePathResult.statusCode.name);
226
- }
227
- return dataValue.value.value;
228
- });
186
+ async getCertificateTypes() {
187
+ const browsePathResult = await this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CertificateTypes"));
188
+ if (browsePathResult.statusCode.isNotGood()) {
189
+ throw new Error(browsePathResult.statusCode.name);
190
+ }
191
+ const certificateTypesNodeId = browsePathResult.targets[0].targetId;
192
+ const dataValue = await this.session.read({ nodeId: certificateTypesNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value });
193
+ if (dataValue.statusCode.isNotGood()) {
194
+ throw new Error(browsePathResult.statusCode.name);
195
+ }
196
+ return dataValue.value.value;
229
197
  }
230
- getTrustList() {
231
- return __awaiter(this, void 0, void 0, function* () {
232
- const browsePathResult = yield this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/TrustList"));
233
- if (browsePathResult.statusCode.isNotGood()) {
234
- throw new Error(browsePathResult.statusCode.name);
235
- }
236
- const trustListNodeId = browsePathResult.targets[0].targetId;
237
- return new TrustListClient(this.session, trustListNodeId);
238
- });
198
+ async getTrustList() {
199
+ const browsePathResult = await this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/TrustList"));
200
+ if (browsePathResult.statusCode.isNotGood()) {
201
+ throw new Error(browsePathResult.statusCode.name);
202
+ }
203
+ const trustListNodeId = browsePathResult.targets[0].targetId;
204
+ return new TrustListClient(this.session, trustListNodeId);
239
205
  }
240
206
  }
241
207
  exports.CertificateGroup = CertificateGroup;
@@ -281,32 +247,30 @@ class ClientPushCertificateManagement {
281
247
  * BadInvalidArgument The certificateTypeId, certificateGroupId or subjectName is not valid.
282
248
  * BadUserAccessDenied The current user does not have the rights required.
283
249
  */
284
- createSigningRequest(certificateGroupId, certificateTypeId, subjectName, regeneratePrivateKey, nonce) {
285
- return __awaiter(this, void 0, void 0, function* () {
286
- nonce = nonce || Buffer.alloc(0);
287
- const inputArguments = [
288
- { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
289
- { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
290
- { dataType: node_opcua_variant_1.DataType.String, value: subjectName },
291
- { dataType: node_opcua_variant_1.DataType.Boolean, value: !!regeneratePrivateKey },
292
- { dataType: node_opcua_variant_1.DataType.ByteString, value: nonce }
293
- ];
294
- const methodToCall = {
295
- inputArguments,
296
- methodId: createSigningRequestMethod,
297
- objectId: serverConfigurationNodeId
250
+ async createSigningRequest(certificateGroupId, certificateTypeId, subjectName, regeneratePrivateKey, nonce) {
251
+ nonce = nonce || Buffer.alloc(0);
252
+ const inputArguments = [
253
+ { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
254
+ { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
255
+ { dataType: node_opcua_variant_1.DataType.String, value: subjectName },
256
+ { dataType: node_opcua_variant_1.DataType.Boolean, value: !!regeneratePrivateKey },
257
+ { dataType: node_opcua_variant_1.DataType.ByteString, value: nonce }
258
+ ];
259
+ const methodToCall = {
260
+ inputArguments,
261
+ methodId: createSigningRequestMethod,
262
+ objectId: serverConfigurationNodeId
263
+ };
264
+ const callMethodResult = await this.session.call(methodToCall);
265
+ if (callMethodResult.statusCode.isGood()) {
266
+ return {
267
+ certificateSigningRequest: callMethodResult.outputArguments[0].value,
268
+ statusCode: callMethodResult.statusCode
298
269
  };
299
- const callMethodResult = yield this.session.call(methodToCall);
300
- if (callMethodResult.statusCode.isGood()) {
301
- return {
302
- certificateSigningRequest: callMethodResult.outputArguments[0].value,
303
- statusCode: callMethodResult.statusCode
304
- };
305
- }
306
- else {
307
- return { statusCode: callMethodResult.statusCode };
308
- }
309
- });
270
+ }
271
+ else {
272
+ return { statusCode: callMethodResult.statusCode };
273
+ }
310
274
  }
311
275
  /**
312
276
  * GetRejectedList Method returns the list of Certificates that have been rejected by the Server.
@@ -319,63 +283,59 @@ class ClientPushCertificateManagement {
319
283
  *
320
284
  * @return certificates The DER encoded form of the Certificates rejected by the Server
321
285
  */
322
- getRejectedList() {
323
- return __awaiter(this, void 0, void 0, function* () {
324
- const inputArguments = [];
325
- const methodToCall = {
326
- inputArguments,
327
- methodId: getRejectedListMethod,
328
- objectId: serverConfigurationNodeId
329
- };
330
- const callMethodResult = yield this.session.call(methodToCall);
331
- if (callMethodResult.statusCode.isGood()) {
332
- if (callMethodResult.outputArguments[0].dataType !== node_opcua_variant_1.DataType.ByteString) {
333
- return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
334
- }
335
- return {
336
- certificates: callMethodResult.outputArguments[0].value,
337
- statusCode: callMethodResult.statusCode
338
- };
339
- }
340
- else {
341
- return {
342
- statusCode: callMethodResult.statusCode
343
- };
286
+ async getRejectedList() {
287
+ const inputArguments = [];
288
+ const methodToCall = {
289
+ inputArguments,
290
+ methodId: getRejectedListMethod,
291
+ objectId: serverConfigurationNodeId
292
+ };
293
+ const callMethodResult = await this.session.call(methodToCall);
294
+ if (callMethodResult.statusCode.isGood()) {
295
+ if (callMethodResult.outputArguments[0].dataType !== node_opcua_variant_1.DataType.ByteString) {
296
+ return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
344
297
  }
345
- });
346
- }
347
- updateCertificate(certificateGroupId, certificateTypeId, certificate, issuerCertificates, privateKeyFormat, privateKey) {
348
- return __awaiter(this, void 0, void 0, function* () {
349
- const inputArguments = [
350
- { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
351
- { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
352
- { dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
353
- { dataType: node_opcua_variant_1.DataType.ByteString, arrayType: node_opcua_variant_1.VariantArrayType.Array, value: issuerCertificates },
354
- { dataType: node_opcua_variant_1.DataType.String, value: privateKeyFormat || "" },
355
- { dataType: node_opcua_variant_1.DataType.ByteString, value: privateKeyFormat ? privateKey : Buffer.alloc(0) }
356
- ];
357
- const methodToCall = {
358
- inputArguments,
359
- methodId: updateCertificateMethod,
360
- objectId: serverConfigurationNodeId
298
+ return {
299
+ certificates: callMethodResult.outputArguments[0].value,
300
+ statusCode: callMethodResult.statusCode
361
301
  };
362
- const callMethodResult = yield this.session.call(methodToCall);
363
- if (callMethodResult.statusCode.isGood()) {
364
- if (!callMethodResult.outputArguments || callMethodResult.outputArguments.length !== 1) {
365
- return {
366
- statusCode: node_opcua_status_code_1.StatusCodes.BadInternalError
367
- };
368
- // throw Error("Internal Error, expecting 1 output result");
369
- }
302
+ }
303
+ else {
304
+ return {
305
+ statusCode: callMethodResult.statusCode
306
+ };
307
+ }
308
+ }
309
+ async updateCertificate(certificateGroupId, certificateTypeId, certificate, issuerCertificates, privateKeyFormat, privateKey) {
310
+ const inputArguments = [
311
+ { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
312
+ { dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
313
+ { dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
314
+ { dataType: node_opcua_variant_1.DataType.ByteString, arrayType: node_opcua_variant_1.VariantArrayType.Array, value: issuerCertificates },
315
+ { dataType: node_opcua_variant_1.DataType.String, value: privateKeyFormat || "" },
316
+ { dataType: node_opcua_variant_1.DataType.ByteString, value: privateKeyFormat ? privateKey : Buffer.alloc(0) }
317
+ ];
318
+ const methodToCall = {
319
+ inputArguments,
320
+ methodId: updateCertificateMethod,
321
+ objectId: serverConfigurationNodeId
322
+ };
323
+ const callMethodResult = await this.session.call(methodToCall);
324
+ if (callMethodResult.statusCode.isGood()) {
325
+ if (!callMethodResult.outputArguments || callMethodResult.outputArguments.length !== 1) {
370
326
  return {
371
- applyChangesRequired: callMethodResult.outputArguments[0].value,
372
- statusCode: callMethodResult.statusCode
327
+ statusCode: node_opcua_status_code_1.StatusCodes.BadInternalError
373
328
  };
329
+ // throw Error("Internal Error, expecting 1 output result");
374
330
  }
375
- else {
376
- return { statusCode: callMethodResult.statusCode };
377
- }
378
- });
331
+ return {
332
+ applyChangesRequired: callMethodResult.outputArguments[0].value,
333
+ statusCode: callMethodResult.statusCode
334
+ };
335
+ }
336
+ else {
337
+ return { statusCode: callMethodResult.statusCode };
338
+ }
379
339
  }
380
340
  /**
381
341
  * ApplyChanges tells the Server to apply any security changes.
@@ -398,64 +358,52 @@ class ClientPushCertificateManagement {
398
358
  * Result Code Description
399
359
  * BadUserAccessDenied The current user does not have the rights required.
400
360
  */
401
- applyChanges() {
402
- return __awaiter(this, void 0, void 0, function* () {
403
- const methodToCall = {
404
- inputArguments: [],
405
- methodId: applyChangesMethod,
406
- objectId: serverConfigurationNodeId
407
- };
408
- const callMethodResult = yield this.session.call(methodToCall);
409
- if (callMethodResult.outputArguments && callMethodResult.outputArguments.length) {
410
- throw new Error("Invalid output arguments");
411
- }
412
- return callMethodResult.statusCode;
413
- });
361
+ async applyChanges() {
362
+ const methodToCall = {
363
+ inputArguments: [],
364
+ methodId: applyChangesMethod,
365
+ objectId: serverConfigurationNodeId
366
+ };
367
+ const callMethodResult = await this.session.call(methodToCall);
368
+ if (callMethodResult.outputArguments && callMethodResult.outputArguments.length) {
369
+ throw new Error("Invalid output arguments");
370
+ }
371
+ return callMethodResult.statusCode;
414
372
  }
415
- getSupportedPrivateKeyFormats() {
416
- return __awaiter(this, void 0, void 0, function* () {
417
- const dataValue = yield this.session.read({
418
- attributeId: node_opcua_data_model_1.AttributeIds.Value,
419
- nodeId: supportedPrivateKeyFormatsNodeId
420
- });
421
- return dataValue.value.value;
373
+ async getSupportedPrivateKeyFormats() {
374
+ const dataValue = await this.session.read({
375
+ attributeId: node_opcua_data_model_1.AttributeIds.Value,
376
+ nodeId: supportedPrivateKeyFormatsNodeId
422
377
  });
378
+ return dataValue.value.value;
423
379
  }
424
- getCertificateGroupId(certificateGroupName) {
425
- return __awaiter(this, void 0, void 0, function* () {
426
- if (certificateGroupName === "DefaultApplicationGroup") {
427
- return defaultApplicationGroup;
428
- }
429
- // toDO
430
- throw new Error("Not Implemented yet");
431
- });
380
+ async getCertificateGroupId(certificateGroupName) {
381
+ if (certificateGroupName === "DefaultApplicationGroup") {
382
+ return defaultApplicationGroup;
383
+ }
384
+ // toDO
385
+ throw new Error("Not Implemented yet");
432
386
  }
433
387
  /**
434
388
  *
435
389
  * @param browseName
436
390
  */
437
- getCertificateGroup(browseName) {
438
- return __awaiter(this, void 0, void 0, function* () {
439
- browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(browseName);
440
- if (browseName.toString() === "DefaultApplicationGroup") {
441
- return new CertificateGroup(this.session, defaultApplicationGroup);
442
- }
443
- if (browseName.toString() === "DefaultUserTokenGroup") {
444
- return new CertificateGroup(this.session, defaultUserTokenGroup);
445
- }
446
- // istanbul ignore next
447
- throw new Error("Not Implemented yet");
448
- });
391
+ async getCertificateGroup(browseName) {
392
+ browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(browseName);
393
+ if (browseName.toString() === "DefaultApplicationGroup") {
394
+ return new CertificateGroup(this.session, defaultApplicationGroup);
395
+ }
396
+ if (browseName.toString() === "DefaultUserTokenGroup") {
397
+ return new CertificateGroup(this.session, defaultUserTokenGroup);
398
+ }
399
+ // istanbul ignore next
400
+ throw new Error("Not Implemented yet");
449
401
  }
450
- getApplicationGroup() {
451
- return __awaiter(this, void 0, void 0, function* () {
452
- return this.getCertificateGroup("DefaultApplicationGroup");
453
- });
402
+ async getApplicationGroup() {
403
+ return this.getCertificateGroup("DefaultApplicationGroup");
454
404
  }
455
- getUserTokenGroup() {
456
- return __awaiter(this, void 0, void 0, function* () {
457
- return this.getCertificateGroup("DefaultUserTokenGroup");
458
- });
405
+ async getUserTokenGroup() {
406
+ return this.getCertificateGroup("DefaultUserTokenGroup");
459
407
  }
460
408
  }
461
409
  exports.ClientPushCertificateManagement = ClientPushCertificateManagement;