node-opcua-crypto 5.3.3 → 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-R6I4NJSZ.cjs → chunk-AZUYUXWD.cjs} +17 -16
- package/dist/chunk-AZUYUXWD.cjs.map +1 -0
- package/dist/{chunk-MFGOTDMX.js → chunk-P5QLLSP2.js} +12 -11
- package/dist/chunk-P5QLLSP2.js.map +1 -0
- package/dist/{chunk-DC5KIPR2.js → chunk-ULNIL7FF.js} +2 -2
- package/dist/{chunk-XJHDKGLH.cjs → chunk-XDS5YIBC.cjs} +22 -22
- package/dist/{chunk-XJHDKGLH.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 +2 -2
- package/dist/chunk-MFGOTDMX.js.map +0 -1
- package/dist/chunk-R6I4NJSZ.cjs.map +0 -1
- /package/dist/{chunk-DC5KIPR2.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) {
|
|
@@ -6631,4 +6632,4 @@ asn1js/build/index.es.js:
|
|
|
6631
6632
|
*
|
|
6632
6633
|
*)
|
|
6633
6634
|
*/
|
|
6634
|
-
//# sourceMappingURL=chunk-
|
|
6635
|
+
//# sourceMappingURL=chunk-P5QLLSP2.js.map
|