node-opcua-server-configuration 2.57.0 → 2.61.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/server/install_CertificateAlarm.js +2 -2
- package/dist/server/install_CertificateAlarm.js.map +1 -1
- package/dist/server/promote_trust_list.js +6 -4
- package/dist/server/promote_trust_list.js.map +1 -1
- package/package.json +20 -20
- package/source/server/install_CertificateAlarm.ts +2 -2
- package/source/server/promote_trust_list.ts +71 -78
|
@@ -21,8 +21,8 @@ function installCertificateExpirationAlarm(addressSpace) {
|
|
|
21
21
|
browseName: "ServerCertificateAlarm",
|
|
22
22
|
conditionSource: null,
|
|
23
23
|
eventSourceOf: server,
|
|
24
|
-
inputNode: node_opcua_nodeid_1.NodeId
|
|
25
|
-
normalState: node_opcua_nodeid_1.NodeId
|
|
24
|
+
inputNode: new node_opcua_nodeid_1.NodeId(),
|
|
25
|
+
normalState: new node_opcua_nodeid_1.NodeId()
|
|
26
26
|
};
|
|
27
27
|
const data = {};
|
|
28
28
|
const alarm = node_opcua_address_space_1.UACertificateExpirationAlarmImpl.instantiate(namespace, options, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install_CertificateAlarm.js","sourceRoot":"","sources":["../../source/server/install_CertificateAlarm.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,uEAIkC;AAClC,uDAI0B;AAC1B,yDAE2B;AAC3B,2DAA8C;AAE9C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,qBAAqB,CAAC,CAAC;AAEtD,SAAgB,iCAAiC,CAAC,YAA0B;;IAExE,QAAQ,CAAC,mCAAmC,CAAC,CAAC;IAE9C,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC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AAwF;IACxF,KAAK,CAAC,aAAa,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,MAAA,KAAK,CAAC,eAAe,0CAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvC,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAC,QAAQ,EAAE,6BAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpF,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAC,QAAQ,EAAE,6BAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpF,CAAC;AA3BD,8EA2BC"}
|
|
@@ -20,8 +20,8 @@ const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
|
20
20
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
21
21
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
22
22
|
const node_opcua_file_transfer_1 = require("node-opcua-file-transfer");
|
|
23
|
-
const trust_list_server_1 = require("./trust_list_server");
|
|
24
23
|
const node_opcua_crypto_1 = require("node-opcua-crypto");
|
|
24
|
+
const trust_list_server_1 = require("./trust_list_server");
|
|
25
25
|
const tools_1 = require("./tools");
|
|
26
26
|
const roles_and_permissions_1 = require("./roles_and_permissions");
|
|
27
27
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)("ServerConfiguration");
|
|
@@ -62,7 +62,7 @@ function _addCertificate(inputArguments, context) {
|
|
|
62
62
|
const certificateChain = inputArguments[0].value;
|
|
63
63
|
const isTrustedCertificate = inputArguments[1].value;
|
|
64
64
|
const certificates = (0, node_opcua_crypto_1.split_der)(certificateChain);
|
|
65
|
-
// validate certificate first
|
|
65
|
+
// validate certificate first
|
|
66
66
|
const r = yield (0, node_opcua_crypto_1.verifyCertificateChain)(certificates);
|
|
67
67
|
if (r.status !== "Good") {
|
|
68
68
|
warningLog("Invalid certificate ", r.status, r.reason);
|
|
@@ -122,10 +122,12 @@ function promoteTrustList(trustList) {
|
|
|
122
122
|
// possible statusCode: Bad_UserAccessDenied The current user does not have the rights required.
|
|
123
123
|
const certificateManager = trustList.$$certificateManager || undefined;
|
|
124
124
|
if (certificateManager) {
|
|
125
|
-
(0, trust_list_server_1.writeTrustList)(memfs_1.fs, filename, trustMask, certificateManager)
|
|
125
|
+
(0, trust_list_server_1.writeTrustList)(memfs_1.fs, filename, trustMask, certificateManager)
|
|
126
|
+
.then(() => {
|
|
126
127
|
// trustList.isOpened = true;
|
|
127
128
|
_open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
128
|
-
})
|
|
129
|
+
})
|
|
130
|
+
.catch((err) => {
|
|
129
131
|
errorLog(err);
|
|
130
132
|
callback(err, { statusCode: node_opcua_status_code_1.StatusCodes.BadInternalError });
|
|
131
133
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote_trust_list.js","sourceRoot":"","sources":["../../source/server/promote_trust_list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"promote_trust_list.js","sourceRoot":"","sources":["../../source/server/promote_trust_list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,+BAAmC;AACnC,iCAAoC;AAapC,uDAAkF;AAClF,mEAAgE;AAEhE,2DAAuD;AACvD,iEAA+D;AAE/D,uEAAqF;AAErF,yDAAsE;AAEtE,2DAAqE;AAErE,mCAAqE;AACrE,mEAAkE;AAElE,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,qBAAqB,CAAC,CA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AAC,aAAD,CAAC,uBAAD,CAAC,CAAE,qBAAqB,CAAC,8CAAsB,CAAC,eAAe,GAAG,8CAAsB,CAAC,kBAAkB,CAAC,CAAC;KAChH;AACL,CAAC;AALD,kFAKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server-configuration",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.61.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -server",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -12,35 +12,35 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"memfs": "^3.3.0",
|
|
15
|
-
"node-opcua-address-space": "2.
|
|
15
|
+
"node-opcua-address-space": "2.61.0",
|
|
16
16
|
"node-opcua-assert": "2.55.0",
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-certificate-manager": "2.
|
|
19
|
-
"node-opcua-client": "2.
|
|
17
|
+
"node-opcua-basic-types": "2.61.0",
|
|
18
|
+
"node-opcua-certificate-manager": "2.61.0",
|
|
19
|
+
"node-opcua-client": "2.61.0",
|
|
20
20
|
"node-opcua-constants": "2.52.0",
|
|
21
21
|
"node-opcua-crypto": "^1.7.4",
|
|
22
|
-
"node-opcua-data-model": "2.
|
|
23
|
-
"node-opcua-debug": "2.
|
|
24
|
-
"node-opcua-file-transfer": "2.
|
|
22
|
+
"node-opcua-data-model": "2.61.0",
|
|
23
|
+
"node-opcua-debug": "2.61.0",
|
|
24
|
+
"node-opcua-file-transfer": "2.61.0",
|
|
25
25
|
"node-opcua-hostname": "2.55.0",
|
|
26
|
-
"node-opcua-nodeid": "2.
|
|
26
|
+
"node-opcua-nodeid": "2.61.0",
|
|
27
27
|
"node-opcua-nodesets": "2.57.0",
|
|
28
|
-
"node-opcua-pki": "^2.12.
|
|
29
|
-
"node-opcua-pseudo-session": "2.
|
|
30
|
-
"node-opcua-secure-channel": "2.
|
|
31
|
-
"node-opcua-server": "2.
|
|
32
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
28
|
+
"node-opcua-pki": "^2.12.1",
|
|
29
|
+
"node-opcua-pseudo-session": "2.61.0",
|
|
30
|
+
"node-opcua-secure-channel": "2.61.0",
|
|
31
|
+
"node-opcua-server": "2.61.0",
|
|
32
|
+
"node-opcua-service-translate-browse-path": "2.61.0",
|
|
33
33
|
"node-opcua-status-code": "2.56.0",
|
|
34
|
-
"node-opcua-types": "2.
|
|
35
|
-
"node-opcua-variant": "2.
|
|
34
|
+
"node-opcua-types": "2.61.0",
|
|
35
|
+
"node-opcua-variant": "2.61.0",
|
|
36
36
|
"rimraf": "^3.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"node-opcua-binary-stream": "2.55.0",
|
|
40
|
-
"node-opcua-data-value": "2.
|
|
41
|
-
"node-opcua-leak-detector": "2.
|
|
40
|
+
"node-opcua-data-value": "2.61.0",
|
|
41
|
+
"node-opcua-leak-detector": "2.61.0",
|
|
42
42
|
"should": "^13.2.3",
|
|
43
|
-
"sinon": "^
|
|
43
|
+
"sinon": "^12.0.1"
|
|
44
44
|
},
|
|
45
45
|
"author": "Etienne Rossignon",
|
|
46
46
|
"license": "MIT",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"internet of things"
|
|
58
58
|
],
|
|
59
59
|
"homepage": "http://node-opcua.github.io/",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "dd8776f047686ca791989f27e11ee48bfd8b61b7"
|
|
61
61
|
}
|
|
@@ -34,8 +34,8 @@ export function installCertificateExpirationAlarm(addressSpace: AddressSpace) {
|
|
|
34
34
|
browseName: "ServerCertificateAlarm",
|
|
35
35
|
conditionSource: null,
|
|
36
36
|
eventSourceOf: server,
|
|
37
|
-
inputNode: NodeId
|
|
38
|
-
normalState: NodeId
|
|
37
|
+
inputNode: new NodeId(),
|
|
38
|
+
normalState: new NodeId()
|
|
39
39
|
};
|
|
40
40
|
const data = {};
|
|
41
41
|
const alarm = UACertificateExpirationAlarmImpl.instantiate(namespace, options, data);
|
|
@@ -2,54 +2,44 @@
|
|
|
2
2
|
* @module node-opcua-server-configuration
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "node-opcua-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "node-opcua-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
TrustListMasks,
|
|
35
|
-
writeTrustList
|
|
36
|
-
} from "./trust_list_server";
|
|
37
|
-
import { split_der, verifyCertificateChain } from "node-opcua-crypto";
|
|
5
|
+
import { callbackify } from "util";
|
|
6
|
+
import { fs as MemFs } from "memfs";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
AddressSpace,
|
|
10
|
+
MethodFunctor,
|
|
11
|
+
SessionContext,
|
|
12
|
+
UAMethod,
|
|
13
|
+
UATrustList,
|
|
14
|
+
UAObject,
|
|
15
|
+
UAVariable,
|
|
16
|
+
ISessionContext,
|
|
17
|
+
IAddressSpace
|
|
18
|
+
} from "node-opcua-address-space";
|
|
19
|
+
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
20
|
+
import { CallbackT, StatusCodes } from "node-opcua-status-code";
|
|
21
|
+
import { CallMethodResultOptions } from "node-opcua-types";
|
|
22
|
+
import { DataType, Variant } from "node-opcua-variant";
|
|
23
|
+
import { AccessRestrictionsFlag } from "node-opcua-data-model";
|
|
24
|
+
import { CertificateManager } from "node-opcua-pki";
|
|
25
|
+
import { AbstractFs, installFileType, OpenFileMode } from "node-opcua-file-transfer";
|
|
26
|
+
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
27
|
+
import { split_der, verifyCertificateChain } from "node-opcua-crypto";
|
|
28
|
+
|
|
29
|
+
import { TrustListMasks, writeTrustList } from "./trust_list_server";
|
|
30
|
+
|
|
38
31
|
import { hasEncryptedChannel, hasExpectedUserAccess } from "./tools";
|
|
39
32
|
import { rolePermissionAdminOnly } from "./roles_and_permissions";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
|
|
34
|
+
const debugLog = make_debugLog("ServerConfiguration");
|
|
35
|
+
const doDebug = checkDebugFlag("ServerConfiguration");
|
|
36
|
+
const warningLog = make_warningLog("ServerConfiguration");
|
|
37
|
+
const errorLog = debugLog;
|
|
38
|
+
|
|
47
39
|
function trustListIsAlreadyOpened(trustList: UATrustList): boolean {
|
|
48
40
|
return false; // to do...
|
|
49
41
|
}
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
43
|
async function _closeAndUpdate(
|
|
54
44
|
this: UAMethod,
|
|
55
45
|
inputArguments: Variant[],
|
|
@@ -58,14 +48,12 @@ async function _closeAndUpdate(
|
|
|
58
48
|
return { statusCode: StatusCodes.Good };
|
|
59
49
|
}
|
|
60
50
|
|
|
61
|
-
|
|
62
51
|
// in TrustList
|
|
63
52
|
async function _addCertificate(
|
|
64
53
|
this: UAMethod,
|
|
65
54
|
inputArguments: Variant[],
|
|
66
55
|
context: ISessionContext
|
|
67
56
|
): Promise<CallMethodResultOptions> {
|
|
68
|
-
|
|
69
57
|
// If the Certificate is issued by a CA then the Client shall provide the entire
|
|
70
58
|
// chain in the certificate argument (see OPC 10000-6). After validating the Certificate,
|
|
71
59
|
// the Server shall add the CA Certificates to the Issuers list in the Trust List.
|
|
@@ -76,9 +64,9 @@ async function _addCertificate(
|
|
|
76
64
|
if (!hasExpectedUserAccess(context)) {
|
|
77
65
|
return { statusCode: StatusCodes.BadUserAccessDenied };
|
|
78
66
|
}
|
|
79
|
-
|
|
67
|
+
|
|
80
68
|
const trustList = context.object as UATrustList;
|
|
81
|
-
const cm = (trustList as any).$$certificateManager as CertificateManager || null;
|
|
69
|
+
const cm = ((trustList as any).$$certificateManager as CertificateManager) || null;
|
|
82
70
|
|
|
83
71
|
// The trust list must have been bound
|
|
84
72
|
if (!cm) {
|
|
@@ -94,13 +82,13 @@ async function _addCertificate(
|
|
|
94
82
|
|
|
95
83
|
const certificates = split_der(certificateChain);
|
|
96
84
|
|
|
97
|
-
// validate certificate first
|
|
85
|
+
// validate certificate first
|
|
98
86
|
const r = await verifyCertificateChain(certificates);
|
|
99
|
-
if (r.status !== "Good"){
|
|
87
|
+
if (r.status !== "Good") {
|
|
100
88
|
warningLog("Invalid certificate ", r.status, r.reason);
|
|
101
89
|
return { statusCode: StatusCodes.BadCertificateInvalid };
|
|
102
90
|
}
|
|
103
|
-
|
|
91
|
+
|
|
104
92
|
for (let i = 0; i < certificates.length; i++) {
|
|
105
93
|
const certificate = certificates[i];
|
|
106
94
|
if (i === certificates.length - 1 && isTrustedCertificate) {
|
|
@@ -111,14 +99,12 @@ async function _addCertificate(
|
|
|
111
99
|
}
|
|
112
100
|
debugLog("_addCertificate - done isTrustedCertificate= ", isTrustedCertificate);
|
|
113
101
|
return { statusCode: StatusCodes.Good };
|
|
114
|
-
|
|
115
102
|
}
|
|
116
103
|
async function _removeCertificate(
|
|
117
104
|
this: UAMethod,
|
|
118
105
|
inputArguments: Variant[],
|
|
119
106
|
context: ISessionContext
|
|
120
107
|
): Promise<CallMethodResultOptions> {
|
|
121
|
-
|
|
122
108
|
if (!hasEncryptedChannel(context)) {
|
|
123
109
|
return { statusCode: StatusCodes.BadSecurityModeInsufficient };
|
|
124
110
|
}
|
|
@@ -130,13 +116,9 @@ async function _removeCertificate(
|
|
|
130
116
|
return { statusCode: StatusCodes.Good };
|
|
131
117
|
}
|
|
132
118
|
|
|
133
|
-
|
|
134
119
|
let counter = 0;
|
|
135
120
|
|
|
136
|
-
|
|
137
121
|
export async function promoteTrustList(trustList: UATrustList) {
|
|
138
|
-
|
|
139
|
-
|
|
140
122
|
const filename = `/tmpFile${counter}`;
|
|
141
123
|
counter += 1;
|
|
142
124
|
|
|
@@ -152,11 +134,15 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
152
134
|
const addCertificate = trustList.getChildByName("AddCertificate") as UAMethod;
|
|
153
135
|
const removeCertificate = trustList.getChildByName("RemoveCertificate") as UAMethod;
|
|
154
136
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
137
|
+
function _openTrustList(
|
|
138
|
+
this: any,
|
|
139
|
+
trustMask: TrustListMasks,
|
|
140
|
+
inputArgs: Variant[],
|
|
141
|
+
context: ISessionContext,
|
|
142
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
143
|
+
) {
|
|
158
144
|
if (trustListIsAlreadyOpened(trustList)) {
|
|
159
|
-
return callback(null, { statusCode: StatusCodes.BadInvalidState })
|
|
145
|
+
return callback(null, { statusCode: StatusCodes.BadInvalidState });
|
|
160
146
|
}
|
|
161
147
|
// if (trustList.isOpened) {
|
|
162
148
|
// warningLog("TrustList is already opened")
|
|
@@ -166,45 +152,55 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
166
152
|
// The Open Method shall not support modes other than Read (0x01) and the Write + EraseExisting (0x06).
|
|
167
153
|
const openMask = inputArgs[0].value as number;
|
|
168
154
|
if (openMask !== OpenFileMode.Read && openMask !== OpenFileMode.WriteEraseExisting) {
|
|
169
|
-
return callback(null, { statusCode: StatusCodes.BadInvalidArgument })
|
|
155
|
+
return callback(null, { statusCode: StatusCodes.BadInvalidArgument });
|
|
170
156
|
}
|
|
171
157
|
// possible statusCode: Bad_UserAccessDenied The current user does not have the rights required.
|
|
172
|
-
const certificateManager = (trustList as any).$$certificateManager as OPCUACertificateManager || undefined;
|
|
158
|
+
const certificateManager = ((trustList as any).$$certificateManager as OPCUACertificateManager) || undefined;
|
|
173
159
|
if (certificateManager) {
|
|
174
|
-
writeTrustList(MemFs as AbstractFs, filename, trustMask, certificateManager)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
writeTrustList(MemFs as AbstractFs, filename, trustMask, certificateManager)
|
|
161
|
+
.then(() => {
|
|
162
|
+
// trustList.isOpened = true;
|
|
163
|
+
|
|
164
|
+
_open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
165
|
+
})
|
|
166
|
+
.catch((err) => {
|
|
167
|
+
errorLog(err);
|
|
168
|
+
callback(err, { statusCode: StatusCodes.BadInternalError });
|
|
169
|
+
});
|
|
183
170
|
} else {
|
|
184
|
-
warningLog("certificateManager is not defined on trustlist do something to update the document before we open it")
|
|
171
|
+
warningLog("certificateManager is not defined on trustlist do something to update the document before we open it");
|
|
185
172
|
return _open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
186
173
|
}
|
|
187
174
|
}
|
|
188
175
|
|
|
189
|
-
function _openCallback(
|
|
176
|
+
function _openCallback(
|
|
177
|
+
this: any,
|
|
178
|
+
inputArgs: Variant[],
|
|
179
|
+
context: ISessionContext,
|
|
180
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
181
|
+
) {
|
|
190
182
|
_openTrustList.call(this, TrustListMasks.All, inputArgs, context, callback);
|
|
191
183
|
}
|
|
192
184
|
|
|
193
185
|
open.bindMethod(_openCallback);
|
|
194
186
|
|
|
195
|
-
function _openWithMaskCallback(
|
|
187
|
+
function _openWithMaskCallback(
|
|
188
|
+
this: any,
|
|
189
|
+
inputArgs: Variant[],
|
|
190
|
+
context: ISessionContext,
|
|
191
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
192
|
+
) {
|
|
196
193
|
const trustListMask = inputArgs[0].value as number;
|
|
197
194
|
inputArgs[0] = new Variant({ dataType: DataType.Byte, value: OpenFileMode.Read });
|
|
198
195
|
_openTrustList.call(this, trustListMask, inputArgs, context, callback);
|
|
199
196
|
}
|
|
200
197
|
// The OpenWithMasks Method allows a Client to read only the portion of the Trust List.
|
|
201
198
|
// This Method can only be used to read the Trust List.
|
|
202
|
-
openWithMasks.bindMethod(_openWithMaskCallback)
|
|
199
|
+
openWithMasks.bindMethod(_openWithMaskCallback);
|
|
203
200
|
addCertificate.bindMethod(callbackify(_addCertificate));
|
|
204
201
|
removeCertificate.bindMethod(callbackify(_removeCertificate));
|
|
205
202
|
closeAndUpdate?.bindMethod(callbackify(_closeAndUpdate));
|
|
206
203
|
|
|
207
|
-
|
|
208
204
|
function install_method_handle_on_TrustListType(addressSpace: IAddressSpace): void {
|
|
209
205
|
const fileType = addressSpace.findObjectType("TrustListType") as any;
|
|
210
206
|
if (!fileType || fileType.addCertificate.isBound()) {
|
|
@@ -217,11 +213,8 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
217
213
|
fileType.closeAndUpdate && fileType.closeAndUpdate.bindMethod(callbackify(_closeAndUpdate));
|
|
218
214
|
}
|
|
219
215
|
install_method_handle_on_TrustListType(trustList.addressSpace);
|
|
220
|
-
|
|
221
216
|
}
|
|
222
217
|
|
|
223
|
-
|
|
224
|
-
|
|
225
218
|
export function installAccessRestrictionOnTrustList(trustList: UAVariable | UAObject) {
|
|
226
219
|
for (const m of trustList.getComponents()) {
|
|
227
220
|
m?.setRolePermissions(rolePermissionAdminOnly);
|