node-opcua-common
Advanced tools
Comparing version 2.85.0 to 2.86.0
/// <reference types="node" /> | ||
/** | ||
* @module node-opcua-common | ||
*/ | ||
import { EventEmitter } from "events"; | ||
import { Certificate, PrivateKeyPEM } from "node-opcua-crypto"; | ||
import { Certificate, PrivateKey } from "node-opcua-crypto"; | ||
export interface ICertificateKeyPairProvider { | ||
getCertificate(): Certificate; | ||
getCertificateChain(): Certificate; | ||
getPrivateKey(): PrivateKeyPEM; | ||
getPrivateKey(): PrivateKey; | ||
} | ||
@@ -15,3 +12,3 @@ export interface ICertificateKeyPairProviderPriv extends ICertificateKeyPairProvider { | ||
$$certificateChain: null | Certificate; | ||
$$privateKeyPEM: null | PrivateKeyPEM; | ||
$$privateKey: null | PrivateKey; | ||
} | ||
@@ -36,3 +33,3 @@ export interface IOPCUASecureObjectOptions { | ||
getCertificateChain(): Certificate; | ||
getPrivateKey(): PrivateKeyPEM; | ||
getPrivateKey(): PrivateKey; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OPCUASecureObject = void 0; | ||
/** | ||
* @module node-opcua-common | ||
*/ | ||
const events_1 = require("events"); | ||
@@ -15,4 +12,4 @@ const fs = require("fs"); | ||
} | ||
function _load_private_key_pem(privateKeyFilename) { | ||
return (0, node_opcua_crypto_1.readKeyPem)(privateKeyFilename); | ||
function _load_private_key(privateKeyFilename) { | ||
return (0, node_opcua_crypto_1.readPrivateKey)(privateKeyFilename); | ||
} | ||
@@ -57,7 +54,7 @@ /** | ||
const priv = this; | ||
if (!priv.$$privateKeyPEM) { | ||
if (!priv.$$privateKey) { | ||
(0, node_opcua_assert_1.assert)(fs.existsSync(this.privateKeyFile), "private file must exist :" + this.privateKeyFile); | ||
priv.$$privateKeyPEM = _load_private_key_pem(this.privateKeyFile); | ||
priv.$$privateKey = _load_private_key(this.privateKeyFile); | ||
} | ||
return priv.$$privateKeyPEM; | ||
return priv.$$privateKey; | ||
} | ||
@@ -64,0 +61,0 @@ } |
{ | ||
"name": "node-opcua-common", | ||
"version": "2.85.0", | ||
"version": "2.86.0", | ||
"description": "pure nodejs OPCUA SDK - module -common", | ||
@@ -15,4 +15,4 @@ "scripts": { | ||
"node-opcua-assert": "2.77.0", | ||
"node-opcua-crypto": "^1.12.0", | ||
"node-opcua-types": "2.85.0" | ||
"node-opcua-crypto": "^2.1.2", | ||
"node-opcua-types": "2.86.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "devDependencies": { | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "68498fcf7b20ea9f7bd66e8529c546221daf5d52" | ||
"gitHead": "36afc46fe2c91aa5664a8c5418f4db5a354670c3" | ||
} |
/** | ||
* @module node-opcua-common | ||
*/ | ||
import { createPrivateKey } from "crypto"; | ||
import { EventEmitter } from "events"; | ||
@@ -8,3 +9,3 @@ import * as fs from "fs"; | ||
import { assert } from "node-opcua-assert"; | ||
import { Certificate, PrivateKeyPEM, readCertificate, readKeyPem, split_der } from "node-opcua-crypto"; | ||
import { Certificate, PrivateKey, readCertificate, readPrivateKey, split_der } from "node-opcua-crypto"; | ||
@@ -14,3 +15,3 @@ export interface ICertificateKeyPairProvider { | ||
getCertificateChain(): Certificate; | ||
getPrivateKey(): PrivateKeyPEM; | ||
getPrivateKey(): PrivateKey; | ||
} | ||
@@ -20,3 +21,3 @@ export interface ICertificateKeyPairProviderPriv extends ICertificateKeyPairProvider { | ||
$$certificateChain: null | Certificate; | ||
$$privateKeyPEM: null | PrivateKeyPEM; | ||
$$privateKey: null | PrivateKey; | ||
} | ||
@@ -28,4 +29,4 @@ function _load_certificate(certificateFilename: string): Certificate { | ||
function _load_private_key_pem(privateKeyFilename: string): PrivateKeyPEM { | ||
return readKeyPem(privateKeyFilename); | ||
function _load_private_key(privateKeyFilename: string): PrivateKey { | ||
return readPrivateKey(privateKeyFilename); | ||
} | ||
@@ -81,10 +82,10 @@ | ||
public getPrivateKey(): PrivateKeyPEM { | ||
public getPrivateKey(): PrivateKey { | ||
const priv = this as unknown as ICertificateKeyPairProviderPriv; | ||
if (!priv.$$privateKeyPEM) { | ||
if (!priv.$$privateKey) { | ||
assert(fs.existsSync(this.privateKeyFile), "private file must exist :" + this.privateKeyFile); | ||
priv.$$privateKeyPEM = _load_private_key_pem(this.privateKeyFile); | ||
priv.$$privateKey = _load_private_key(this.privateKeyFile); | ||
} | ||
return priv.$$privateKeyPEM; | ||
return priv.$$privateKey; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22019
291
+ Addednode-opcua-basic-types@2.86.0(transitive)
+ Addednode-opcua-binary-stream@2.86.0(transitive)
+ Addednode-opcua-buffer-utils@2.86.0(transitive)
+ Addednode-opcua-crypto@2.2.0(transitive)
+ Addednode-opcua-data-model@2.86.0(transitive)
+ Addednode-opcua-data-value@2.86.0(transitive)
+ Addednode-opcua-date-time@2.86.0(transitive)
+ Addednode-opcua-debug@2.86.0(transitive)
+ Addednode-opcua-enum@2.86.0(transitive)
+ Addednode-opcua-extension-object@2.86.0(transitive)
+ Addednode-opcua-factory@2.86.0(transitive)
+ Addednode-opcua-generator@2.86.0(transitive)
+ Addednode-opcua-nodeid@2.86.0(transitive)
+ Addednode-opcua-numeric-range@2.86.0(transitive)
+ Addednode-opcua-schemas@2.86.0(transitive)
+ Addednode-opcua-status-code@2.86.0(transitive)
+ Addednode-opcua-types@2.86.0(transitive)
+ Addednode-opcua-utils@2.86.0(transitive)
+ Addednode-opcua-variant@2.86.0(transitive)
+ Addednode-opcua-xml2json@2.86.0(transitive)
- Removednode-opcua-basic-types@2.85.0(transitive)
- Removednode-opcua-binary-stream@2.85.0(transitive)
- Removednode-opcua-buffer-utils@2.85.0(transitive)
- Removednode-opcua-crypto@1.12.0(transitive)
- Removednode-opcua-data-model@2.85.0(transitive)
- Removednode-opcua-data-value@2.85.0(transitive)
- Removednode-opcua-date-time@2.85.0(transitive)
- Removednode-opcua-debug@2.85.0(transitive)
- Removednode-opcua-enum@2.85.0(transitive)
- Removednode-opcua-extension-object@2.85.0(transitive)
- Removednode-opcua-factory@2.85.0(transitive)
- Removednode-opcua-generator@2.85.0(transitive)
- Removednode-opcua-nodeid@2.85.0(transitive)
- Removednode-opcua-numeric-range@2.85.0(transitive)
- Removednode-opcua-schemas@2.85.0(transitive)
- Removednode-opcua-status-code@2.85.0(transitive)
- Removednode-opcua-types@2.85.0(transitive)
- Removednode-opcua-utils@2.85.0(transitive)
- Removednode-opcua-variant@2.85.0(transitive)
- Removednode-opcua-xml2json@2.85.0(transitive)
Updatednode-opcua-crypto@^2.1.2
Updatednode-opcua-types@2.86.0