node-opcua-crypto 4.12.0 → 4.16.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.
@@ -71,7 +71,7 @@ import {
71
71
  verifyChunkSignature,
72
72
  verifyChunkSignatureWithDerivedKeys,
73
73
  verifyMessageChunkSignature
74
- } from "../chunk-LHUQUHQQ.mjs";
74
+ } from "../chunk-F5EAPW2U.mjs";
75
75
  export {
76
76
  CertificatePurpose,
77
77
  PaddingAlgorithm,
@@ -123,7 +123,7 @@ var { hexy } = import_hexy.default;
123
123
  var PEM_REGEX = /^(-----BEGIN (.*)-----\r?\n([/+=a-zA-Z0-9\r\n]*)\r?\n-----END \2-----\r?\n?)/gm;
124
124
  var PEM_TYPE_REGEX = /^(-----BEGIN (.*)-----)/m;
125
125
  function identifyPemType(rawKey) {
126
- if (rawKey instanceof Buffer) {
126
+ if (Buffer.isBuffer(rawKey)) {
127
127
  rawKey = rawKey.toString("utf8");
128
128
  }
129
129
  const match = PEM_TYPE_REGEX.exec(rawKey);
@@ -138,7 +138,7 @@ function toPem(raw_key, pem) {
138
138
  (0, import_assert4.default)(typeof pem === "string");
139
139
  let pemType = identifyPemType(raw_key);
140
140
  if (pemType) {
141
- return raw_key instanceof Buffer ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
141
+ return Buffer.isBuffer(raw_key) ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
142
142
  } else {
143
143
  pemType = pem;
144
144
  (0, import_assert4.default)(["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
@@ -198,7 +198,7 @@ function readPublicKey(filename) {
198
198
  }
199
199
  function myCreatePrivateKey(rawKey) {
200
200
  if (!import_crypto.createPrivateKey || process.env.NO_CREATE_PRIVATEKEY) {
201
- if (rawKey instanceof Buffer) {
201
+ if (Buffer.isBuffer(rawKey)) {
202
202
  const pemKey = toPem(rawKey, "PRIVATE KEY");
203
203
  (0, import_assert5.default)(["RSA PRIVATE KEY", "PRIVATE KEY"].indexOf(identifyPemType(pemKey)) >= 0);
204
204
  return { hidden: pemKey };
@@ -4070,7 +4070,7 @@ async function generatePrivateKeyFile(privateKeyFilename, modulusLength) {
4070
4070
  const privateKeyPem = await privateKeyToPEM(keys.privateKey);
4071
4071
  await import_node_fs4.default.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, "utf-8");
4072
4072
  privateKeyPem.privPem = "";
4073
- privateKeyPem.privDer = new Uint8Array(0);
4073
+ privateKeyPem.privDer = new ArrayBuffer(0);
4074
4074
  }
4075
4075
  async function generatePrivateKeyFileAlternate(privateKeyFilename, modulusLength) {
4076
4076
  const kp = import_jsrsasign3.default.KEYUTIL.generateKeypair("RSA", modulusLength);