node-opcua-crypto 5.3.4 → 5.3.5

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.
@@ -645,7 +645,17 @@ function toPem(raw_key, pem) {
645
645
  } else {
646
646
  pemType = pem;
647
647
  _assert2.default.call(void 0, ["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
648
- const b = raw_key.toString("base64");
648
+ const buffer = raw_key;
649
+ if (pemType === "CERTIFICATE" && buffer.length > 0) {
650
+ try {
651
+ const parts = split_der(buffer);
652
+ if (parts.length > 1) {
653
+ return parts.map((cert) => toPem(cert, pem)).join("\n");
654
+ }
655
+ } catch (err) {
656
+ }
657
+ }
658
+ const b = buffer.toString("base64");
649
659
  const strBody = _optionalChain([b, 'access', _9 => _9.match, 'call', _10 => _10(/.{1,64}/g), 'optionalAccess', _11 => _11.join, 'call', _12 => _12("\n")]) || "";
650
660
  return `-----BEGIN ${pemType}-----
651
661
  ${strBody}
@@ -6624,4 +6634,4 @@ asn1js/build/index.es.js:
6624
6634
  *
6625
6635
  *)
6626
6636
  */
6627
- //# sourceMappingURL=chunk-AZUYUXWD.cjs.map
6637
+ //# sourceMappingURL=chunk-LRB5Q533.cjs.map