node-opcua-crypto 5.3.2 → 5.3.4
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/{chunk-TSW463FI.cjs → chunk-AZUYUXWD.cjs} +18 -16
- package/dist/chunk-AZUYUXWD.cjs.map +1 -0
- package/dist/{chunk-ODR4HUB7.js → chunk-P5QLLSP2.js} +13 -11
- package/dist/chunk-P5QLLSP2.js.map +1 -0
- package/dist/{chunk-UEEZA3YS.js → chunk-ULNIL7FF.js} +2 -2
- package/dist/{chunk-IKQT3ICS.cjs → chunk-XDS5YIBC.cjs} +22 -22
- package/dist/{chunk-IKQT3ICS.cjs.map → chunk-XDS5YIBC.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/dist/source/index_web.cjs +2 -2
- package/dist/source/index_web.d.cts +9 -2
- package/dist/source/index_web.d.ts +9 -2
- package/dist/source/index_web.js +1 -1
- package/dist/source_nodejs/index.cjs +3 -3
- package/dist/source_nodejs/index.js +2 -2
- package/package.json +3 -2
- package/dist/chunk-ODR4HUB7.js.map +0 -1
- package/dist/chunk-TSW463FI.cjs.map +0 -1
- /package/dist/{chunk-UEEZA3YS.js.map → chunk-ULNIL7FF.js.map} +0 -0
|
@@ -627,6 +627,9 @@ function hexy(buffer, { width, format } = {}) {
|
|
|
627
627
|
var PEM_REGEX = /^(-----BEGIN (.*)-----\r?\n([/+=a-zA-Z0-9\r\n]*)\r?\n-----END \2-----\r?\n?)/gm;
|
|
628
628
|
var PEM_TYPE_REGEX = /^(-----BEGIN (.*)-----)/m;
|
|
629
629
|
function identifyPemType(rawKey) {
|
|
630
|
+
if (Array.isArray(rawKey)) {
|
|
631
|
+
return void 0;
|
|
632
|
+
}
|
|
630
633
|
if (Buffer.isBuffer(rawKey)) {
|
|
631
634
|
rawKey = rawKey.toString("utf8");
|
|
632
635
|
}
|
|
@@ -640,22 +643,20 @@ function removeTrailingLF(str) {
|
|
|
640
643
|
function toPem(raw_key, pem) {
|
|
641
644
|
assert2(raw_key, "expecting a key");
|
|
642
645
|
assert2(typeof pem === "string");
|
|
646
|
+
if (Array.isArray(raw_key)) {
|
|
647
|
+
return raw_key.map((cert) => toPem(cert, pem)).join("\n");
|
|
648
|
+
}
|
|
643
649
|
let pemType = identifyPemType(raw_key);
|
|
644
650
|
if (pemType) {
|
|
645
651
|
return Buffer.isBuffer(raw_key) ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
|
|
646
652
|
} else {
|
|
647
653
|
pemType = pem;
|
|
648
654
|
assert2(["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
`;
|
|
655
|
-
b = b.substring(64);
|
|
656
|
-
}
|
|
657
|
-
str += `-----END ${pemType}-----`;
|
|
658
|
-
return str;
|
|
655
|
+
const b = raw_key.toString("base64");
|
|
656
|
+
const strBody = b.match(/.{1,64}/g)?.join("\n") || "";
|
|
657
|
+
return `-----BEGIN ${pemType}-----
|
|
658
|
+
${strBody}
|
|
659
|
+
-----END ${pemType}-----`;
|
|
659
660
|
}
|
|
660
661
|
}
|
|
661
662
|
function convertPEMtoDER(raw_key) {
|
|
@@ -1748,6 +1749,7 @@ var Subject = class _Subject {
|
|
|
1748
1749
|
// source/x509/_crypto.ts
|
|
1749
1750
|
import nativeCrypto from "crypto";
|
|
1750
1751
|
import { Crypto as PeculiarWebCrypto } from "@peculiar/webcrypto";
|
|
1752
|
+
import "reflect-metadata";
|
|
1751
1753
|
import * as x509 from "@peculiar/x509";
|
|
1752
1754
|
import * as x5092 from "@peculiar/x509";
|
|
1753
1755
|
var doDebug3 = false;
|
|
@@ -6630,4 +6632,4 @@ asn1js/build/index.es.js:
|
|
|
6630
6632
|
*
|
|
6631
6633
|
*)
|
|
6632
6634
|
*/
|
|
6633
|
-
//# sourceMappingURL=chunk-
|
|
6635
|
+
//# sourceMappingURL=chunk-P5QLLSP2.js.map
|