node-opcua-common 2.97.0 → 2.98.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/package.json +4 -4
- package/dist/applicationurn.d.ts +0 -1
- package/dist/applicationurn.js +0 -26
- package/dist/applicationurn.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -39
- package/dist/index.js.map +0 -1
- package/dist/opcua_secure_object.d.ts +0 -33
- package/dist/opcua_secure_object.js +0 -61
- package/dist/opcua_secure_object.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.98.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -common",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "mocha",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"node-opcua-assert": "2.88.0",
|
|
15
15
|
"node-opcua-crypto": "^2.1.2",
|
|
16
|
-
"node-opcua-types": "2.
|
|
16
|
+
"node-opcua-types": "2.98.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/node": "18.15.
|
|
19
|
+
"@types/node": "18.15.11",
|
|
20
20
|
"should": "^13.2.3"
|
|
21
21
|
},
|
|
22
22
|
"author": "Etienne Rossignon",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"internet of things"
|
|
35
35
|
],
|
|
36
36
|
"homepage": "http://node-opcua.github.io/",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c"
|
|
38
38
|
}
|
package/dist/applicationurn.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function makeApplicationUrn(hostname: string, suffix: string): string;
|
package/dist/applicationurn.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeApplicationUrn = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-common
|
|
6
|
-
*/
|
|
7
|
-
const crypto = require("crypto");
|
|
8
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
9
|
-
function makeApplicationUrn(hostname, suffix) {
|
|
10
|
-
(0, node_opcua_assert_1.assert)(!suffix.match(/urn:/), "already a application URN ?");
|
|
11
|
-
// beware : Openssl doesn't support urn with length greater than 64 !!
|
|
12
|
-
// sometimes hostname length could be too long ...
|
|
13
|
-
// application urn length must not exceed 64 car. to comply with openssl
|
|
14
|
-
// see cryptoCA
|
|
15
|
-
let hostnameHash = hostname;
|
|
16
|
-
if (hostnameHash.length + 7 + suffix.length >= 64) {
|
|
17
|
-
// we need to reduce the applicationUrn side => let's take
|
|
18
|
-
// a portion of the hostname hash.
|
|
19
|
-
hostnameHash = crypto.createHash("md5").update(hostname).digest("hex").substring(0, 16);
|
|
20
|
-
}
|
|
21
|
-
const applicationUrn = "urn:" + hostnameHash + ":" + suffix;
|
|
22
|
-
(0, node_opcua_assert_1.assert)(applicationUrn.length <= 64);
|
|
23
|
-
return applicationUrn;
|
|
24
|
-
}
|
|
25
|
-
exports.makeApplicationUrn = makeApplicationUrn;
|
|
26
|
-
//# sourceMappingURL=applicationurn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applicationurn.js","sourceRoot":"","sources":["../source/applicationurn.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,iCAAiC;AAEjC,yDAA2C;AAE3C,SAAgB,kBAAkB,CAAC,QAAgB,EAAE,MAAc;IAC/D,IAAA,0BAAM,EAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC,CAAC;IAC7D,sEAAsE;IACtE,2DAA2D;IAC3D,wEAAwE;IACxE,eAAe;IACf,IAAI,YAAY,GAAG,QAAQ,CAAC;IAC5B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE;QAC/C,0DAA0D;QAC1D,kCAAkC;QAClC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC3F;IACD,MAAM,cAAc,GAAG,MAAM,GAAG,YAAY,GAAG,GAAG,GAAG,MAAM,CAAC;IAC5D,IAAA,0BAAM,EAAC,cAAc,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACpC,OAAO,cAAc,CAAC;AAC1B,CAAC;AAfD,gDAeC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-common
|
|
3
|
-
*/
|
|
4
|
-
export { ServerState, ServerStatusDataType, // ServerStatus
|
|
5
|
-
RedundantServerDataType, // RedundantServer
|
|
6
|
-
ModelChangeStructureDataType, // ModelChangeStructure
|
|
7
|
-
SubscriptionDiagnosticsDataType, // SubscriptionDiagnostics
|
|
8
|
-
SamplingIntervalDiagnosticsDataType, // SamplingIntervalDiagnostics
|
|
9
|
-
SemanticChangeStructureDataType, // SemanticChangeStructure
|
|
10
|
-
ServerDiagnosticsSummaryDataType, SessionSecurityDiagnosticsDataType, ServiceCounterDataType, SessionDiagnosticsDataType, BuildInfo, DataTypeDefinition, EnumValueType, TimeZoneDataType, } from "node-opcua-types";
|
|
11
|
-
export * from "./applicationurn";
|
|
12
|
-
export * from "./opcua_secure_object";
|
package/dist/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
exports.TimeZoneDataType = exports.EnumValueType = exports.DataTypeDefinition = exports.BuildInfo = exports.SessionDiagnosticsDataType = exports.ServiceCounterDataType = exports.SessionSecurityDiagnosticsDataType = exports.ServerDiagnosticsSummaryDataType = exports.SemanticChangeStructureDataType = exports.SamplingIntervalDiagnosticsDataType = exports.SubscriptionDiagnosticsDataType = exports.ModelChangeStructureDataType = exports.RedundantServerDataType = exports.ServerStatusDataType = exports.ServerState = void 0;
|
|
18
|
-
/**
|
|
19
|
-
* @module node-opcua-common
|
|
20
|
-
*/
|
|
21
|
-
var node_opcua_types_1 = require("node-opcua-types");
|
|
22
|
-
Object.defineProperty(exports, "ServerState", { enumerable: true, get: function () { return node_opcua_types_1.ServerState; } });
|
|
23
|
-
Object.defineProperty(exports, "ServerStatusDataType", { enumerable: true, get: function () { return node_opcua_types_1.ServerStatusDataType; } });
|
|
24
|
-
Object.defineProperty(exports, "RedundantServerDataType", { enumerable: true, get: function () { return node_opcua_types_1.RedundantServerDataType; } });
|
|
25
|
-
Object.defineProperty(exports, "ModelChangeStructureDataType", { enumerable: true, get: function () { return node_opcua_types_1.ModelChangeStructureDataType; } });
|
|
26
|
-
Object.defineProperty(exports, "SubscriptionDiagnosticsDataType", { enumerable: true, get: function () { return node_opcua_types_1.SubscriptionDiagnosticsDataType; } });
|
|
27
|
-
Object.defineProperty(exports, "SamplingIntervalDiagnosticsDataType", { enumerable: true, get: function () { return node_opcua_types_1.SamplingIntervalDiagnosticsDataType; } });
|
|
28
|
-
Object.defineProperty(exports, "SemanticChangeStructureDataType", { enumerable: true, get: function () { return node_opcua_types_1.SemanticChangeStructureDataType; } });
|
|
29
|
-
Object.defineProperty(exports, "ServerDiagnosticsSummaryDataType", { enumerable: true, get: function () { return node_opcua_types_1.ServerDiagnosticsSummaryDataType; } });
|
|
30
|
-
Object.defineProperty(exports, "SessionSecurityDiagnosticsDataType", { enumerable: true, get: function () { return node_opcua_types_1.SessionSecurityDiagnosticsDataType; } });
|
|
31
|
-
Object.defineProperty(exports, "ServiceCounterDataType", { enumerable: true, get: function () { return node_opcua_types_1.ServiceCounterDataType; } });
|
|
32
|
-
Object.defineProperty(exports, "SessionDiagnosticsDataType", { enumerable: true, get: function () { return node_opcua_types_1.SessionDiagnosticsDataType; } });
|
|
33
|
-
Object.defineProperty(exports, "BuildInfo", { enumerable: true, get: function () { return node_opcua_types_1.BuildInfo; } });
|
|
34
|
-
Object.defineProperty(exports, "DataTypeDefinition", { enumerable: true, get: function () { return node_opcua_types_1.DataTypeDefinition; } });
|
|
35
|
-
Object.defineProperty(exports, "EnumValueType", { enumerable: true, get: function () { return node_opcua_types_1.EnumValueType; } });
|
|
36
|
-
Object.defineProperty(exports, "TimeZoneDataType", { enumerable: true, get: function () { return node_opcua_types_1.TimeZoneDataType; } });
|
|
37
|
-
__exportStar(require("./applicationurn"), exports);
|
|
38
|
-
__exportStar(require("./opcua_secure_object"), exports);
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAgB0B;AAftB,+GAAA,WAAW,OAAA;AACX,wHAAA,oBAAoB,OAAA;AACpB,2HAAA,uBAAuB,OAAA;AACvB,gIAAA,4BAA4B,OAAA;AAC5B,mIAAA,+BAA+B,OAAA;AAC/B,uIAAA,mCAAmC,OAAA;AACnC,mIAAA,+BAA+B,OAAA;AAC/B,oIAAA,gCAAgC,OAAA;AAChC,sIAAA,kCAAkC,OAAA;AAClC,0HAAA,sBAAsB,OAAA;AACtB,8HAAA,0BAA0B,OAAA;AAC1B,6GAAA,SAAS,OAAA;AACT,sHAAA,kBAAkB,OAAA;AAClB,iHAAA,aAAa,OAAA;AACb,oHAAA,gBAAgB,OAAA;AAGpB,mDAAiC;AACjC,wDAAsC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
import { Certificate, PrivateKey } from "node-opcua-crypto";
|
|
4
|
-
export interface ICertificateKeyPairProvider {
|
|
5
|
-
getCertificate(): Certificate;
|
|
6
|
-
getCertificateChain(): Certificate;
|
|
7
|
-
getPrivateKey(): PrivateKey;
|
|
8
|
-
}
|
|
9
|
-
export interface ICertificateKeyPairProviderPriv extends ICertificateKeyPairProvider {
|
|
10
|
-
$$certificate: null | Certificate;
|
|
11
|
-
$$certificateChain: null | Certificate;
|
|
12
|
-
$$privateKey: null | PrivateKey;
|
|
13
|
-
}
|
|
14
|
-
export interface IOPCUASecureObjectOptions {
|
|
15
|
-
certificateFile?: string;
|
|
16
|
-
privateKeyFile?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* an object that provides a certificate and a privateKey
|
|
20
|
-
* @class OPCUASecureObject
|
|
21
|
-
* @param options
|
|
22
|
-
* @param options.certificateFile {string}
|
|
23
|
-
* @param options.privateKeyFile {string}
|
|
24
|
-
* @constructor
|
|
25
|
-
*/
|
|
26
|
-
export declare class OPCUASecureObject extends EventEmitter implements ICertificateKeyPairProvider {
|
|
27
|
-
readonly certificateFile: string;
|
|
28
|
-
readonly privateKeyFile: string;
|
|
29
|
-
constructor(options: IOPCUASecureObjectOptions);
|
|
30
|
-
getCertificate(): Certificate;
|
|
31
|
-
getCertificateChain(): Certificate;
|
|
32
|
-
getPrivateKey(): PrivateKey;
|
|
33
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OPCUASecureObject = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
7
|
-
const node_opcua_crypto_1 = require("node-opcua-crypto");
|
|
8
|
-
function _load_certificate(certificateFilename) {
|
|
9
|
-
const der = (0, node_opcua_crypto_1.readCertificate)(certificateFilename);
|
|
10
|
-
return der;
|
|
11
|
-
}
|
|
12
|
-
function _load_private_key(privateKeyFilename) {
|
|
13
|
-
return (0, node_opcua_crypto_1.readPrivateKey)(privateKeyFilename);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* an object that provides a certificate and a privateKey
|
|
17
|
-
* @class OPCUASecureObject
|
|
18
|
-
* @param options
|
|
19
|
-
* @param options.certificateFile {string}
|
|
20
|
-
* @param options.privateKeyFile {string}
|
|
21
|
-
* @constructor
|
|
22
|
-
*/
|
|
23
|
-
class OPCUASecureObject extends events_1.EventEmitter {
|
|
24
|
-
constructor(options) {
|
|
25
|
-
super();
|
|
26
|
-
(0, node_opcua_assert_1.assert)(typeof options.certificateFile === "string");
|
|
27
|
-
(0, node_opcua_assert_1.assert)(typeof options.privateKeyFile === "string");
|
|
28
|
-
this.certificateFile = options.certificateFile || "invalid certificate file";
|
|
29
|
-
this.privateKeyFile = options.privateKeyFile || "invalid private key file";
|
|
30
|
-
}
|
|
31
|
-
getCertificate() {
|
|
32
|
-
const priv = this;
|
|
33
|
-
if (!priv.$$certificate) {
|
|
34
|
-
const certChain = this.getCertificateChain();
|
|
35
|
-
priv.$$certificate = (0, node_opcua_crypto_1.split_der)(certChain)[0];
|
|
36
|
-
}
|
|
37
|
-
return priv.$$certificate;
|
|
38
|
-
}
|
|
39
|
-
getCertificateChain() {
|
|
40
|
-
const priv = this;
|
|
41
|
-
if (!priv.$$certificateChain) {
|
|
42
|
-
(0, node_opcua_assert_1.assert)(fs.existsSync(this.certificateFile), "Certificate file must exist :" + this.certificateFile);
|
|
43
|
-
priv.$$certificateChain = _load_certificate(this.certificateFile);
|
|
44
|
-
if (priv.$$certificateChain && priv.$$certificateChain.length === 0) {
|
|
45
|
-
priv.$$certificateChain = _load_certificate(this.certificateFile);
|
|
46
|
-
throw new Error("Invalid certificate length = 0 " + this.certificateFile);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return priv.$$certificateChain;
|
|
50
|
-
}
|
|
51
|
-
getPrivateKey() {
|
|
52
|
-
const priv = this;
|
|
53
|
-
if (!priv.$$privateKey) {
|
|
54
|
-
(0, node_opcua_assert_1.assert)(fs.existsSync(this.privateKeyFile), "private file must exist :" + this.privateKeyFile);
|
|
55
|
-
priv.$$privateKey = _load_private_key(this.privateKeyFile);
|
|
56
|
-
}
|
|
57
|
-
return priv.$$privateKey;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.OPCUASecureObject = OPCUASecureObject;
|
|
61
|
-
//# sourceMappingURL=opcua_secure_object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opcua_secure_object.js","sourceRoot":"","sources":["../source/opcua_secure_object.ts"],"names":[],"mappings":";;;AAIA,mCAAsC;AACtC,yBAAyB;AAEzB,yDAA2C;AAC3C,yDAAwG;AAYxG,SAAS,iBAAiB,CAAC,mBAA2B;IAClD,MAAM,GAAG,GAAG,IAAA,mCAAe,EAAC,mBAAmB,CAAC,CAAC;IACjD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,iBAAiB,CAAC,kBAA0B;IACjD,OAA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