@peculiar/certificates-viewer 4.3.0 → 4.3.1

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.
Files changed (95) hide show
  1. package/components/download.js +72 -1
  2. package/components/download.js.map +1 -1
  3. package/dist/cjs/{certification_request-314859bb.js → certification_request-ad267278.js} +73 -2
  4. package/dist/cjs/certification_request-ad267278.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +2 -2
  6. package/dist/cjs/{miscellaneous-f1bc3a4b.js → miscellaneous-67439e59.js} +2 -2
  7. package/dist/cjs/{miscellaneous-f1bc3a4b.js.map → miscellaneous-67439e59.js.map} +1 -1
  8. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js +4 -4
  9. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +4 -4
  10. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +3 -3
  11. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +2 -2
  12. package/dist/cjs/{pkcs10_certificate_request-93c66ce7.js → pkcs10_certificate_request-64898c88.js} +2 -2
  13. package/dist/cjs/{pkcs10_certificate_request-93c66ce7.js.map → pkcs10_certificate_request-64898c88.js.map} +1 -1
  14. package/dist/cjs/{x509_certificate-0776e3ec.js → x509_certificate-4b0894c2.js} +2 -2
  15. package/dist/cjs/{x509_certificate-0776e3ec.js.map → x509_certificate-4b0894c2.js.map} +1 -1
  16. package/dist/cjs/{x509_crl-5326d209.js → x509_crl-fc8d41a1.js} +3 -3
  17. package/dist/cjs/{x509_crl-5326d209.js.map → x509_crl-fc8d41a1.js.map} +1 -1
  18. package/dist/esm/{certification_request-b531916a.js → certification_request-a4699dcf.js} +73 -2
  19. package/dist/esm/certification_request-a4699dcf.js.map +1 -0
  20. package/dist/esm/index.js +2 -2
  21. package/dist/esm/{miscellaneous-7fe71e3f.js → miscellaneous-ba1fd2bd.js} +2 -2
  22. package/dist/esm/{miscellaneous-7fe71e3f.js.map → miscellaneous-ba1fd2bd.js.map} +1 -1
  23. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js +4 -4
  24. package/dist/esm/peculiar-certificate-decoder.entry.js +4 -4
  25. package/dist/esm/peculiar-certificate-viewer.entry.js +3 -3
  26. package/dist/esm/peculiar-certificates-viewer.entry.js +2 -2
  27. package/dist/esm/{pkcs10_certificate_request-cca2ca68.js → pkcs10_certificate_request-785a4794.js} +2 -2
  28. package/dist/esm/{pkcs10_certificate_request-cca2ca68.js.map → pkcs10_certificate_request-785a4794.js.map} +1 -1
  29. package/dist/esm/{x509_certificate-050175dd.js → x509_certificate-05a23c0e.js} +2 -2
  30. package/dist/esm/{x509_certificate-050175dd.js.map → x509_certificate-05a23c0e.js.map} +1 -1
  31. package/dist/esm/{x509_crl-c497f907.js → x509_crl-26081461.js} +3 -3
  32. package/dist/esm/{x509_crl-c497f907.js.map → x509_crl-26081461.js.map} +1 -1
  33. package/dist/esm-es5/{certification_request-b531916a.js → certification_request-a4699dcf.js} +3 -3
  34. package/dist/esm-es5/certification_request-a4699dcf.js.map +1 -0
  35. package/dist/esm-es5/index.js +1 -1
  36. package/dist/esm-es5/{miscellaneous-7fe71e3f.js → miscellaneous-ba1fd2bd.js} +2 -2
  37. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js +1 -1
  38. package/dist/esm-es5/peculiar-certificate-decoder.entry.js +1 -1
  39. package/dist/esm-es5/peculiar-certificate-viewer.entry.js +1 -1
  40. package/dist/esm-es5/peculiar-certificates-viewer.entry.js +1 -1
  41. package/dist/esm-es5/{pkcs10_certificate_request-cca2ca68.js → pkcs10_certificate_request-785a4794.js} +2 -2
  42. package/dist/esm-es5/{x509_certificate-050175dd.js → x509_certificate-05a23c0e.js} +2 -2
  43. package/dist/esm-es5/{x509_crl-c497f907.js → x509_crl-26081461.js} +2 -2
  44. package/dist/peculiar/index.esm.js +1 -1
  45. package/dist/peculiar/{p-bd7fb688.system.entry.js → p-1566ad92.system.entry.js} +2 -2
  46. package/dist/peculiar/{p-52f13c4a.system.js → p-2bc2abea.system.js} +2 -2
  47. package/dist/peculiar/{p-666438a8.js → p-32807e5e.js} +11 -11
  48. package/dist/peculiar/p-32807e5e.js.map +1 -0
  49. package/dist/peculiar/{p-7a5173be.entry.js → p-5d1d4a96.entry.js} +2 -2
  50. package/dist/peculiar/{p-ddadcb44.entry.js → p-67e82386.entry.js} +2 -2
  51. package/dist/peculiar/{p-adf16adb.js → p-6e2ad7eb.js} +2 -2
  52. package/dist/peculiar/{p-a06f51a2.system.js → p-7ddd9a82.system.js} +2 -2
  53. package/dist/peculiar/p-8393399a.system.js +1 -1
  54. package/dist/peculiar/{p-cc256004.system.entry.js → p-9263e7ee.system.entry.js} +2 -2
  55. package/dist/peculiar/{p-05af3b74.system.js → p-98e3a016.system.js} +4 -4
  56. package/dist/peculiar/{p-6221d0a4.system.entry.js → p-9ad547d2.system.entry.js} +2 -2
  57. package/dist/peculiar/{p-d6229f42.system.js → p-a1a48332.system.js} +2 -2
  58. package/dist/peculiar/{p-80477c05.js → p-ab5a4988.js} +2 -2
  59. package/dist/peculiar/{p-163a3052.system.js → p-ae44c2b0.system.js} +5 -5
  60. package/dist/peculiar/{p-8ff95ad8.entry.js → p-bafd67f3.entry.js} +2 -2
  61. package/dist/peculiar/{p-494d26fb.entry.js → p-cd1b1876.entry.js} +2 -2
  62. package/dist/peculiar/{p-5a699274.js → p-d5ba4fc2.js} +4 -4
  63. package/dist/peculiar/{p-d1066b51.system.js → p-e37e4df2.system.js} +10 -10
  64. package/dist/peculiar/p-e37e4df2.system.js.map +1 -0
  65. package/dist/peculiar/{p-b6d5e413.js → p-f8c91ee4.js} +4 -4
  66. package/dist/peculiar/{p-2d9c40d6.system.entry.js → p-f9c07207.system.entry.js} +3 -3
  67. package/dist/peculiar/peculiar.esm.js +1 -1
  68. package/hydrate/index.js +72 -1
  69. package/package.json +21 -21
  70. package/dist/cjs/certification_request-314859bb.js.map +0 -1
  71. package/dist/esm/certification_request-b531916a.js.map +0 -1
  72. package/dist/esm-es5/certification_request-b531916a.js.map +0 -1
  73. package/dist/peculiar/p-666438a8.js.map +0 -1
  74. package/dist/peculiar/p-d1066b51.system.js.map +0 -1
  75. /package/dist/esm-es5/{miscellaneous-7fe71e3f.js.map → miscellaneous-ba1fd2bd.js.map} +0 -0
  76. /package/dist/esm-es5/{pkcs10_certificate_request-cca2ca68.js.map → pkcs10_certificate_request-785a4794.js.map} +0 -0
  77. /package/dist/esm-es5/{x509_certificate-050175dd.js.map → x509_certificate-05a23c0e.js.map} +0 -0
  78. /package/dist/esm-es5/{x509_crl-c497f907.js.map → x509_crl-26081461.js.map} +0 -0
  79. /package/dist/peculiar/{p-bd7fb688.system.entry.js.map → p-1566ad92.system.entry.js.map} +0 -0
  80. /package/dist/peculiar/{p-52f13c4a.system.js.map → p-2bc2abea.system.js.map} +0 -0
  81. /package/dist/peculiar/{p-7a5173be.entry.js.map → p-5d1d4a96.entry.js.map} +0 -0
  82. /package/dist/peculiar/{p-ddadcb44.entry.js.map → p-67e82386.entry.js.map} +0 -0
  83. /package/dist/peculiar/{p-adf16adb.js.map → p-6e2ad7eb.js.map} +0 -0
  84. /package/dist/peculiar/{p-a06f51a2.system.js.map → p-7ddd9a82.system.js.map} +0 -0
  85. /package/dist/peculiar/{p-cc256004.system.entry.js.map → p-9263e7ee.system.entry.js.map} +0 -0
  86. /package/dist/peculiar/{p-05af3b74.system.js.map → p-98e3a016.system.js.map} +0 -0
  87. /package/dist/peculiar/{p-6221d0a4.system.entry.js.map → p-9ad547d2.system.entry.js.map} +0 -0
  88. /package/dist/peculiar/{p-d6229f42.system.js.map → p-a1a48332.system.js.map} +0 -0
  89. /package/dist/peculiar/{p-80477c05.js.map → p-ab5a4988.js.map} +0 -0
  90. /package/dist/peculiar/{p-163a3052.system.js.map → p-ae44c2b0.system.js.map} +0 -0
  91. /package/dist/peculiar/{p-8ff95ad8.entry.js.map → p-bafd67f3.entry.js.map} +0 -0
  92. /package/dist/peculiar/{p-494d26fb.entry.js.map → p-cd1b1876.entry.js.map} +0 -0
  93. /package/dist/peculiar/{p-5a699274.js.map → p-d5ba4fc2.js.map} +0 -0
  94. /package/dist/peculiar/{p-b6d5e413.js.map → p-f8c91ee4.js.map} +0 -0
  95. /package/dist/peculiar/{p-2d9c40d6.system.entry.js.map → p-f9c07207.system.entry.js.map} +0 -0
@@ -2,11 +2,11 @@
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
4
  import { h, r as registerInstance, H as Host } from './index-ae188432.js';
5
- import { $ as OIDs, Z as l10n, a0 as Name, n as ActivityDescription, W as WebGDPR, I as InsuranceValue, T as TypeRelationship, V as ValuationRanking, U as UnstructuredName, s as ChallengePassword, C as Convert_1, _ as dateShort, a1 as CRLReason, a2 as InvalidityDate, a3 as CertificateIssuer } from './certification_request-b531916a.js';
6
- import { X as X509AttributeCertificate, a as X509Crl } from './x509_crl-c497f907.js';
7
- import { g as getStringByOID, R as RowValue, c as camelCaseToWords, T as TableRowTable, G as GeneralNamePart, a as RowTitle, B as BasicInformation, S as Signature, b as Thumbprints, d as getLEILink, e as getDNSNameLink, f as getIPAddressLink, E as Extensions, M as Miscellaneous, I as IssuerName, h as SubjectName, P as PublicKey } from './miscellaneous-7fe71e3f.js';
5
+ import { $ as OIDs, Z as l10n, a0 as Name, n as ActivityDescription, W as WebGDPR, I as InsuranceValue, T as TypeRelationship, V as ValuationRanking, U as UnstructuredName, s as ChallengePassword, C as Convert_1, _ as dateShort, a1 as CRLReason, a2 as InvalidityDate, a3 as CertificateIssuer } from './certification_request-a4699dcf.js';
6
+ import { X as X509AttributeCertificate, a as X509Crl } from './x509_crl-26081461.js';
7
+ import { g as getStringByOID, R as RowValue, c as camelCaseToWords, T as TableRowTable, G as GeneralNamePart, a as RowTitle, B as BasicInformation, S as Signature, b as Thumbprints, d as getLEILink, e as getDNSNameLink, f as getIPAddressLink, E as Extensions, M as Miscellaneous, I as IssuerName, h as SubjectName, P as PublicKey } from './miscellaneous-ba1fd2bd.js';
8
8
  import { T as Typography } from './button-a2fabf9a.js';
9
- import { P as Pkcs10CertificateRequest } from './pkcs10_certificate_request-cca2ca68.js';
9
+ import { P as Pkcs10CertificateRequest } from './pkcs10_certificate_request-785a4794.js';
10
10
  import './link-7e4e9060.js';
11
11
  import './download-14dc1047.js';
12
12
 
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-ae188432.js';
5
5
  import { a as readAsBinaryString } from './read_file-bb0b1450.js';
6
- import './certification_request-b531916a.js';
7
- import { X as X509Certificate } from './x509_certificate-050175dd.js';
8
- import { X as X509AttributeCertificate, a as X509Crl } from './x509_crl-c497f907.js';
9
- import { P as Pkcs10CertificateRequest } from './pkcs10_certificate_request-cca2ca68.js';
6
+ import './certification_request-a4699dcf.js';
7
+ import { X as X509Certificate } from './x509_certificate-05a23c0e.js';
8
+ import { X as X509AttributeCertificate, a as X509Crl } from './x509_crl-26081461.js';
9
+ import { P as Pkcs10CertificateRequest } from './pkcs10_certificate_request-785a4794.js';
10
10
  import { T as Typography, B as Button } from './button-a2fabf9a.js';
11
11
 
12
12
  const certificateDecoderCss = "*{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:transparent;font-family:var(--pv-font-family, inherit)}.t-h1{font-weight:var(--pv-text-h1-weight);font-size:var(--pv-text-h1-size);line-height:var(--pv-text-h1-height);letter-spacing:var(--pv-text-h1-spacing)}.t-h2{font-weight:var(--pv-text-h2-weight);font-size:var(--pv-text-h2-size);line-height:var(--pv-text-h2-height);letter-spacing:var(--pv-text-h2-spacing)}.t-h3{font-weight:var(--pv-text-h3-weight);font-size:var(--pv-text-h3-size);line-height:var(--pv-text-h3-height);letter-spacing:var(--pv-text-h3-spacing)}.t-h4{font-weight:var(--pv-text-h4-weight);font-size:var(--pv-text-h4-size);line-height:var(--pv-text-h4-height);letter-spacing:var(--pv-text-h4-spacing)}.t-h5{font-weight:var(--pv-text-h5-weight);font-size:var(--pv-text-h5-size);line-height:var(--pv-text-h5-height);letter-spacing:var(--pv-text-h5-spacing)}.t-s1{font-weight:var(--pv-text-s1-weight);font-size:var(--pv-text-s1-size);line-height:var(--pv-text-s1-height);letter-spacing:var(--pv-text-s1-spacing)}.t-s2{font-weight:var(--pv-text-s2-weight);font-size:var(--pv-text-s2-size);line-height:var(--pv-text-s2-height);letter-spacing:var(--pv-text-s2-spacing)}.t-b1{font-weight:var(--pv-text-b1-weight);font-size:var(--pv-text-b1-size);line-height:var(--pv-text-b1-height);letter-spacing:var(--pv-text-b1-spacing)}.t-b2{font-weight:var(--pv-text-b2-weight);font-size:var(--pv-text-b2-size);line-height:var(--pv-text-b2-height);letter-spacing:var(--pv-text-b2-spacing)}.t-b3{font-weight:var(--pv-text-b3-weight);font-size:var(--pv-text-b3-size);line-height:var(--pv-text-b3-height);letter-spacing:var(--pv-text-b3-spacing)}.t-btn1{font-weight:var(--pv-text-btn1-weight);font-size:var(--pv-text-btn1-size);line-height:var(--pv-text-btn1-height);letter-spacing:var(--pv-text-btn1-spacing)}.t-btn2{font-weight:var(--pv-text-btn2-weight);font-size:var(--pv-text-btn2-size);line-height:var(--pv-text-btn2-height);letter-spacing:var(--pv-text-btn2-spacing)}.t-c1{font-weight:var(--pv-text-c1-weight);font-size:var(--pv-text-c1-size);line-height:var(--pv-text-c1-height);letter-spacing:var(--pv-text-c1-spacing)}.t-c2{font-weight:var(--pv-text-c2-weight);font-size:var(--pv-text-c2-size);line-height:var(--pv-text-c2-height);letter-spacing:var(--pv-text-c2-spacing)}.c-primary-tint-5{--pv-color-base:var(--pv-color-primary-tint-5)}.c-primary-tint-4{--pv-color-base:var(--pv-color-primary-tint-4)}.c-primary-tint-3{--pv-color-base:var(--pv-color-primary-tint-3)}.c-primary-tint-2{--pv-color-base:var(--pv-color-primary-tint-2)}.c-primary-tint-1{--pv-color-base:var(--pv-color-primary-tint-1)}.c-primary{--pv-color-base:var(--pv-color-primary)}.c-primary-shade-1{--pv-color-base:var(--pv-color-primary-shade-1)}.c-primary-shade-2{--pv-color-base:var(--pv-color-primary-shade-2)}.c-primary-shade-3{--pv-color-base:var(--pv-color-primary-shade-3)}.c-primary-shade-4{--pv-color-base:var(--pv-color-primary-shade-4)}.c-primary-shade-5{--pv-color-base:var(--pv-color-primary-shade-5)}.c-primary-contrast{--pv-color-base:var(--pv-color-primary-contrast)}.c-secondary-tint-5{--pv-color-base:var(--pv-color-secondary-tint-5)}.c-secondary-tint-4{--pv-color-base:var(--pv-color-secondary-tint-4)}.c-secondary-tint-3{--pv-color-base:var(--pv-color-secondary-tint-3)}.c-secondary-tint-2{--pv-color-base:var(--pv-color-secondary-tint-2)}.c-secondary-tint-1{--pv-color-base:var(--pv-color-secondary-tint-1)}.c-secondary{--pv-color-base:var(--pv-color-secondary)}.c-secondary-shade-1{--pv-color-base:var(--pv-color-secondary-shade-1)}.c-secondary-shade-2{--pv-color-base:var(--pv-color-secondary-shade-2)}.c-secondary-shade-3{--pv-color-base:var(--pv-color-secondary-shade-3)}.c-secondary-shade-4{--pv-color-base:var(--pv-color-secondary-shade-4)}.c-secondary-shade-5{--pv-color-base:var(--pv-color-secondary-shade-5)}.c-secondary-contrast{--pv-color-base:var(--pv-color-secondary-contrast)}.c-wrong-tint-5{--pv-color-base:var(--pv-color-wrong-tint-5)}.c-wrong-tint-4{--pv-color-base:var(--pv-color-wrong-tint-4)}.c-wrong-tint-3{--pv-color-base:var(--pv-color-wrong-tint-3)}.c-wrong-tint-2{--pv-color-base:var(--pv-color-wrong-tint-2)}.c-wrong-tint-1{--pv-color-base:var(--pv-color-wrong-tint-1)}.c-wrong{--pv-color-base:var(--pv-color-wrong)}.c-wrong-shade-1{--pv-color-base:var(--pv-color-wrong-shade-1)}.c-wrong-shade-2{--pv-color-base:var(--pv-color-wrong-shade-2)}.c-wrong-shade-3{--pv-color-base:var(--pv-color-wrong-shade-3)}.c-wrong-shade-4{--pv-color-base:var(--pv-color-wrong-shade-4)}.c-wrong-shade-5{--pv-color-base:var(--pv-color-wrong-shade-5)}.c-wrong-contrast{--pv-color-base:var(--pv-color-wrong-contrast)}.c-attention-tint-5{--pv-color-base:var(--pv-color-attention-tint-5)}.c-attention-tint-4{--pv-color-base:var(--pv-color-attention-tint-4)}.c-attention-tint-3{--pv-color-base:var(--pv-color-attention-tint-3)}.c-attention-tint-2{--pv-color-base:var(--pv-color-attention-tint-2)}.c-attention-tint-1{--pv-color-base:var(--pv-color-attention-tint-1)}.c-attention{--pv-color-base:var(--pv-color-attention)}.c-attention-shade-1{--pv-color-base:var(--pv-color-attention-shade-1)}.c-attention-shade-2{--pv-color-base:var(--pv-color-attention-shade-2)}.c-attention-shade-3{--pv-color-base:var(--pv-color-attention-shade-3)}.c-attention-shade-4{--pv-color-base:var(--pv-color-attention-shade-4)}.c-attention-shade-5{--pv-color-base:var(--pv-color-attention-shade-5)}.c-success-tint-5{--pv-color-base:var(--pv-color-success-tint-5)}.c-success-tint-4{--pv-color-base:var(--pv-color-success-tint-4)}.c-success-tint-3{--pv-color-base:var(--pv-color-success-tint-3)}.c-success-tint-2{--pv-color-base:var(--pv-color-success-tint-2)}.c-success-tint-1{--pv-color-base:var(--pv-color-success-tint-1)}.c-success{--pv-color-base:var(--pv-color-success)}.c-success-shade-1{--pv-color-base:var(--pv-color-success-shade-1)}.c-success-shade-2{--pv-color-base:var(--pv-color-success-shade-2)}.c-success-shade-3{--pv-color-base:var(--pv-color-success-shade-3)}.c-success-shade-4{--pv-color-base:var(--pv-color-success-shade-4)}.c-success-shade-5{--pv-color-base:var(--pv-color-success-shade-5)}.c-black{--pv-color-base:var(--pv-color-black)}.c-gray-10{--pv-color-base:var(--pv-color-gray-10)}.c-gray-9{--pv-color-base:var(--pv-color-gray-9)}.c-gray-8{--pv-color-base:var(--pv-color-gray-8)}.c-gray-7{--pv-color-base:var(--pv-color-gray-7)}.c-gray-6{--pv-color-base:var(--pv-color-gray-6)}.c-gray-5{--pv-color-base:var(--pv-color-gray-5)}.c-gray-4{--pv-color-base:var(--pv-color-gray-4)}.c-gray-3{--pv-color-base:var(--pv-color-gray-3)}.c-gray-2{--pv-color-base:var(--pv-color-gray-2)}.c-gray-1{--pv-color-base:var(--pv-color-gray-1)}.c-white{--pv-color-base:var(--pv-color-white)}.c-extra-1{--pv-color-base:var(--pv-color-extra-1)}.c-extra-2{--pv-color-base:var(--pv-color-extra-2)}.typography{color:var(--pv-color-base)}.button{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;background:transparent;border:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;text-decoration:none;outline:none;font-family:inherit;border-radius:4px;height:var(--pv-size-base-6);min-width:var(--pv-size-base-6);padding:0 var(--pv-size-base-2);-webkit-transition:background-color 200ms ease 0s;transition:background-color 200ms ease 0s;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:var(--pv-size-base-2);font-size:0}.button.m_no_padding{padding:0}.button:hover{background-color:var(--pv-color-gray-3)}.button:focus{background-color:var(--pv-color-gray-4)}.button:active{background-color:var(--pv-color-gray-5)}:host{display:block;width:100%}.textarea{min-height:300px;width:100%;border-radius:4px;border:1px solid var(--pv-color-gray-5);padding:14px;font-family:monospace;resize:vertical}.viewer{margin-top:var(--pv-size-base-12)}.controls{margin-top:var(--pv-size-base-2);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pv-size-base-2)}.control_row{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:var(--pv-size-base)}";
@@ -2,9 +2,9 @@
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
4
  import { r as registerInstance, h, H as Host } from './index-ae188432.js';
5
- import { X as X509Certificate } from './x509_certificate-050175dd.js';
6
- import './certification_request-b531916a.js';
7
- import { B as BasicInformation, h as SubjectName, I as IssuerName, P as PublicKey, S as Signature, b as Thumbprints, E as Extensions, d as getLEILink, e as getDNSNameLink, f as getIPAddressLink, M as Miscellaneous } from './miscellaneous-7fe71e3f.js';
5
+ import { X as X509Certificate } from './x509_certificate-05a23c0e.js';
6
+ import './certification_request-a4699dcf.js';
7
+ import { B as BasicInformation, h as SubjectName, I as IssuerName, P as PublicKey, S as Signature, b as Thumbprints, E as Extensions, d as getLEILink, e as getDNSNameLink, f as getIPAddressLink, M as Miscellaneous } from './miscellaneous-ba1fd2bd.js';
8
8
  import { T as Typography } from './button-a2fabf9a.js';
9
9
  import './link-7e4e9060.js';
10
10
  import './download-14dc1047.js';
@@ -2,8 +2,8 @@
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
4
  import { h, r as registerInstance, c as createEvent, H as Host } from './index-ae188432.js';
5
- import { X as X509Certificate } from './x509_certificate-050175dd.js';
6
- import { Z as l10n, _ as dateShort, $ as OIDs } from './certification_request-b531916a.js';
5
+ import { X as X509Certificate } from './x509_certificate-05a23c0e.js';
6
+ import { Z as l10n, _ as dateShort, $ as OIDs } from './certification_request-a4699dcf.js';
7
7
  import { T as Typography, B as Button } from './button-a2fabf9a.js';
8
8
  import { D as DetailsIcon, L as LinkIcon, C as CrossIcon } from './cross-1377606f.js';
9
9
  import { D as DownloadIcon } from './download-14dc1047.js';
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
- import { A as AsnData, a as Attribute$1, b as AsnParser, C as Convert_1, i as id_DomainNameBeneficiary, c as DomainNameBeneficiary, e as id_DomainNameLegalRepresentative, f as DomainNameLegalRepresentative, g as id_DomainNameOwner, h as DomainNameOwner, j as id_DomainNameTechnicalOperator, k as DomainNameTechnicalOperator, l as id_TypeRelationship, T as TypeRelationship, m as id_ActivityDescription, n as ActivityDescription, o as id_WebGDPR, W as WebGDPR, p as id_InsuranceValue, I as InsuranceValue, q as id_ValuationRanking, V as ValuationRanking, r as id_pkcs9_at_challengePassword, s as ChallengePassword, t as id_pkcs9_at_unstructuredName, U as UnstructuredName, u as id_pkcs9_at_extensionRequest, E as ExtensionRequest, v as certificateRawToBuffer, w as CertificationRequest, N as Name, x as id_ecPublicKey, y as AsnConvert, z as ECParameters, B as id_rsaEncryption, R as RSAPublicKey, F as getCertificateThumbprint, G as Extension, H as base64Format, J as hexFormat, D as Download } from './certification_request-b531916a.js';
4
+ import { A as AsnData, a as Attribute$1, b as AsnParser, C as Convert_1, i as id_DomainNameBeneficiary, c as DomainNameBeneficiary, e as id_DomainNameLegalRepresentative, f as DomainNameLegalRepresentative, g as id_DomainNameOwner, h as DomainNameOwner, j as id_DomainNameTechnicalOperator, k as DomainNameTechnicalOperator, l as id_TypeRelationship, T as TypeRelationship, m as id_ActivityDescription, n as ActivityDescription, o as id_WebGDPR, W as WebGDPR, p as id_InsuranceValue, I as InsuranceValue, q as id_ValuationRanking, V as ValuationRanking, r as id_pkcs9_at_challengePassword, s as ChallengePassword, t as id_pkcs9_at_unstructuredName, U as UnstructuredName, u as id_pkcs9_at_extensionRequest, E as ExtensionRequest, v as certificateRawToBuffer, w as CertificationRequest, N as Name, x as id_ecPublicKey, y as AsnConvert, z as ECParameters, B as id_rsaEncryption, R as RSAPublicKey, F as getCertificateThumbprint, G as Extension, H as base64Format, J as hexFormat, D as Download } from './certification_request-a4699dcf.js';
5
5
 
6
6
  /**
7
7
  * @license
@@ -143,4 +143,4 @@ class Pkcs10CertificateRequest extends AsnData {
143
143
 
144
144
  export { Attribute as A, Pkcs10CertificateRequest as P };
145
145
 
146
- //# sourceMappingURL=pkcs10_certificate_request-cca2ca68.js.map
146
+ //# sourceMappingURL=pkcs10_certificate_request-785a4794.js.map
@@ -1 +1 @@
1
- {"file":"pkcs10_certificate_request-cca2ca68.js","mappings":";;;;;AAAA;;;;;;;AAoDA,MAAM,iBAAiB,GAAG;IACxB,CAAC,wBAA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IAAI,CACpD,CAAC,SAAS,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,KAAK,4BAA4B,CACpC,CAAC;YAEjC,IAAI,yBAAyB,EAAE;gBAC7B,IAAI,CAAC,UAAU,GAAG,yBAAyB,CAAC,KAAK;qBAC9C,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACvD;SACF;KACF;IAEM,QAAQ,CAAC,SAAmC,KAAK;QACtD,QAAQ,MAAM;YACZ,KAAK,KAAK;gBACR,OAAO,SAAS,CAACA,SAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,KAAK,KAAK;gBACR,OAAO,cAAc,IAAI,CAAC,GAAG,UAAU,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,IAAI,CAAC,GAAG,OAAO,CAAC;YAC5G;gBACE,OAAOA,SAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;KACF;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,GAAG,EACR,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;;;;;","names":["AsnAttribute","Convert"],"sources":["src/crypto/attribute.ts","src/crypto/pkcs10_certificate_request.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Convert } from 'pvtsutils';\nimport { AsnParser } from '@peculiar/asn1-schema';\nimport { Attribute as AsnAttribute } from '@peculiar/asn1-x509';\nimport {\n id_DomainNameBeneficiary,\n DomainNameBeneficiary,\n\n id_DomainNameLegalRepresentative,\n DomainNameLegalRepresentative,\n\n id_DomainNameOwner,\n DomainNameOwner,\n\n id_DomainNameTechnicalOperator,\n DomainNameTechnicalOperator,\n\n id_TypeRelationship,\n TypeRelationship,\n\n id_ActivityDescription,\n ActivityDescription,\n\n id_WebGDPR,\n WebGDPR,\n\n id_InsuranceValue,\n InsuranceValue,\n\n id_ValuationRanking,\n ValuationRanking,\n} from '@peculiar/asn1-ntqwac';\nimport {\n id_pkcs9_at_extensionRequest,\n ExtensionRequest,\n\n id_pkcs9_at_challengePassword,\n ChallengePassword,\n\n id_pkcs9_at_unstructuredName,\n UnstructuredName,\n} from '@peculiar/asn1-pkcs9';\n\nimport { AsnData } from './asn_data';\n\nconst attributesParsers = {\n [id_DomainNameBeneficiary]: DomainNameBeneficiary,\n [id_DomainNameLegalRepresentative]: DomainNameLegalRepresentative,\n [id_DomainNameOwner]: DomainNameOwner,\n [id_DomainNameTechnicalOperator]: DomainNameTechnicalOperator,\n [id_TypeRelationship]: TypeRelationship,\n [id_ActivityDescription]: ActivityDescription,\n [id_WebGDPR]: WebGDPR,\n [id_InsuranceValue]: InsuranceValue,\n [id_ValuationRanking]: ValuationRanking,\n [id_pkcs9_at_challengePassword]: ChallengePassword,\n [id_pkcs9_at_unstructuredName]: UnstructuredName,\n [id_pkcs9_at_extensionRequest]: ExtensionRequest,\n};\n\ntype TAttributeKeys = keyof typeof attributesParsers;\nexport type TAttributeValue = InstanceType<typeof attributesParsers[TAttributeKeys]> | string;\n\nexport class Attribute<T extends TAttributeValue> extends AsnData<AsnAttribute> {\n public readonly value: T;\n\n private getAsnExtnValue() {\n return this.asn.values[0];\n }\n\n constructor(raw: BufferSource) {\n super(raw, AsnAttribute);\n\n const asnExtnValue = this.getAsnExtnValue();\n\n try {\n const target = attributesParsers[this.asn.type];\n\n if (target) {\n this.value = AsnParser.parse<T>(asnExtnValue, target);\n } else {\n console.warn(`Didn't detect parser for \"${this.asn.type}\" attribute.`);\n\n this.value = Convert.ToHex(asnExtnValue) as T;\n }\n } catch (error) {\n console.error(`Error parse \"${this.asn.type}\" attribute:`, error.message);\n\n this.value = Convert.ToHex(asnExtnValue) as T;\n }\n }\n}\n","/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { ECParameters, id_ecPublicKey } from '@peculiar/asn1-ecc';\nimport { id_rsaEncryption, RSAPublicKey } from '@peculiar/asn1-rsa';\nimport { CertificationRequest } from '@peculiar/asn1-csr';\nimport {\n id_pkcs9_at_extensionRequest,\n ExtensionRequest,\n} from '@peculiar/asn1-pkcs9';\nimport { Convert } from 'pvtsutils';\n\nimport { Download } from '../utils';\n\nimport { AsnData } from './asn_data';\nimport { Name, INameJSON } from './name';\nimport { Attribute, TAttributeValue } from './attribute';\nimport { Extension, TExtensionValue } from './extension';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\ninterface IPublicKey {\n algorithm: string;\n value: BufferSource;\n params?: ECParameters | RSAPublicKey;\n}\n\nexport class Pkcs10CertificateRequest extends AsnData<CertificationRequest> {\n public readonly subject: INameJSON[];\n\n public readonly version: number;\n\n public attributes: Attribute<TAttributeValue>[];\n\n public extensions: Extension<TExtensionValue>[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'PKCS#10 Certificate Request';\n\n public readonly tag = 'CERTIFICATE REQUEST';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), CertificationRequest);\n\n const { certificationRequestInfo } = this.asn;\n\n this.subject = new Name(certificationRequestInfo.subject).toJSON();\n this.version = certificationRequestInfo.version;\n }\n\n public get publicKey(): IPublicKey {\n const { subjectPublicKey, algorithm } = this.asn.certificationRequestInfo.subjectPKInfo;\n let params;\n\n if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {\n params = AsnConvert.parse(algorithm.parameters, ECParameters);\n }\n\n if (algorithm.algorithm === id_rsaEncryption) {\n params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);\n }\n\n const spki = AsnConvert.serialize(this.asn.certificationRequestInfo.subjectPKInfo);\n\n return {\n params,\n value: spki,\n algorithm: algorithm.algorithm,\n };\n }\n\n public get signature(): ISignature {\n const { signature, signatureAlgorithm } = this.asn;\n\n return {\n value: signature,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public get commonName(): string {\n if (!this.subject) {\n return '';\n }\n\n for (let i = 0; i < this.subject.length; i += 1) {\n const name = this.subject[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public parseAttributes() {\n const { certificationRequestInfo } = this.asn;\n\n if (certificationRequestInfo.attributes) {\n this.attributes = certificationRequestInfo.attributes\n .map((e) => new Attribute(AsnConvert.serialize(e)));\n\n const extensionRequestAttribute = this.attributes.find(\n (attribute) => attribute.asn.type === id_pkcs9_at_extensionRequest,\n ) as Attribute<ExtensionRequest>;\n\n if (extensionRequestAttribute) {\n this.extensions = extensionRequestAttribute.value\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.csr.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.csr.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n"],"version":3}
1
+ {"file":"pkcs10_certificate_request-785a4794.js","mappings":";;;;;AAAA;;;;;;;AAoDA,MAAM,iBAAiB,GAAG;IACxB,CAAC,wBAAwB,GAAG,qBAAqB;IACjD,CAAC,gCAAgC,GAAG,6BAA6B;IACjE,CAAC,kBAAkB,GAAG,eAAe;IACrC,CAAC,8BAA8B,GAAG,2BAA2B;IAC7D,CAAC,mBAAmB,GAAG,gBAAgB;IACvC,CAAC,sBAAsB,GAAG,mBAAmB;IAC7C,CAAC,UAAU,GAAG,OAAO;IACrB,CAAC,iBAAiB,GAAG,cAAc;IACnC,CAAC,mBAAmB,GAAG,gBAAgB;IACvC,CAAC,6BAA6B,GAAG,iBAAiB;IAClD,CAAC,4BAA4B,GAAG,gBAAgB;IAChD,CAAC,4BAA4B,GAAG,gBAAgB;CACjD,CAAC;MAKW,SAAqC,SAAQ,OAAqB;IAGrE,eAAe;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC3B;IAED,YAAY,GAAiB;QAC3B,KAAK,CAAC,GAAG,EAAEA,WAAY,CAAC,CAAC;QAEzB,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE5C,IAAI;YACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAI,YAAY,EAAE,MAAM,CAAC,CAAC;aACvD;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,CAAC;gBAEvE,IAAI,CAA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,CACxB,CAAC;KACH;;;;;","names":["AsnAttribute","Convert"],"sources":["src/crypto/attribute.ts","src/crypto/pkcs10_certificate_request.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Convert } from 'pvtsutils';\nimport { AsnParser } from '@peculiar/asn1-schema';\nimport { Attribute as AsnAttribute } from '@peculiar/asn1-x509';\nimport {\n id_DomainNameBeneficiary,\n DomainNameBeneficiary,\n\n id_DomainNameLegalRepresentative,\n DomainNameLegalRepresentative,\n\n id_DomainNameOwner,\n DomainNameOwner,\n\n id_DomainNameTechnicalOperator,\n DomainNameTechnicalOperator,\n\n id_TypeRelationship,\n TypeRelationship,\n\n id_ActivityDescription,\n ActivityDescription,\n\n id_WebGDPR,\n WebGDPR,\n\n id_InsuranceValue,\n InsuranceValue,\n\n id_ValuationRanking,\n ValuationRanking,\n} from '@peculiar/asn1-ntqwac';\nimport {\n id_pkcs9_at_extensionRequest,\n ExtensionRequest,\n\n id_pkcs9_at_challengePassword,\n ChallengePassword,\n\n id_pkcs9_at_unstructuredName,\n UnstructuredName,\n} from '@peculiar/asn1-pkcs9';\n\nimport { AsnData } from './asn_data';\n\nconst attributesParsers = {\n [id_DomainNameBeneficiary]: DomainNameBeneficiary,\n [id_DomainNameLegalRepresentative]: DomainNameLegalRepresentative,\n [id_DomainNameOwner]: DomainNameOwner,\n [id_DomainNameTechnicalOperator]: DomainNameTechnicalOperator,\n [id_TypeRelationship]: TypeRelationship,\n [id_ActivityDescription]: ActivityDescription,\n [id_WebGDPR]: WebGDPR,\n [id_InsuranceValue]: InsuranceValue,\n [id_ValuationRanking]: ValuationRanking,\n [id_pkcs9_at_challengePassword]: ChallengePassword,\n [id_pkcs9_at_unstructuredName]: UnstructuredName,\n [id_pkcs9_at_extensionRequest]: ExtensionRequest,\n};\n\ntype TAttributeKeys = keyof typeof attributesParsers;\nexport type TAttributeValue = InstanceType<typeof attributesParsers[TAttributeKeys]> | string;\n\nexport class Attribute<T extends TAttributeValue> extends AsnData<AsnAttribute> {\n public readonly value: T;\n\n private getAsnExtnValue() {\n return this.asn.values[0];\n }\n\n constructor(raw: BufferSource) {\n super(raw, AsnAttribute);\n\n const asnExtnValue = this.getAsnExtnValue();\n\n try {\n const target = attributesParsers[this.asn.type];\n\n if (target) {\n this.value = AsnParser.parse<T>(asnExtnValue, target);\n } else {\n console.warn(`Didn't detect parser for \"${this.asn.type}\" attribute.`);\n\n this.value = Convert.ToHex(asnExtnValue) as T;\n }\n } catch (error) {\n console.error(`Error parse \"${this.asn.type}\" attribute:`, error.message);\n\n this.value = Convert.ToHex(asnExtnValue) as T;\n }\n }\n}\n","/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { ECParameters, id_ecPublicKey } from '@peculiar/asn1-ecc';\nimport { id_rsaEncryption, RSAPublicKey } from '@peculiar/asn1-rsa';\nimport { CertificationRequest } from '@peculiar/asn1-csr';\nimport {\n id_pkcs9_at_extensionRequest,\n ExtensionRequest,\n} from '@peculiar/asn1-pkcs9';\nimport { Convert } from 'pvtsutils';\n\nimport { Download } from '../utils';\n\nimport { AsnData } from './asn_data';\nimport { Name, INameJSON } from './name';\nimport { Attribute, TAttributeValue } from './attribute';\nimport { Extension, TExtensionValue } from './extension';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\ninterface IPublicKey {\n algorithm: string;\n value: BufferSource;\n params?: ECParameters | RSAPublicKey;\n}\n\nexport class Pkcs10CertificateRequest extends AsnData<CertificationRequest> {\n public readonly subject: INameJSON[];\n\n public readonly version: number;\n\n public attributes: Attribute<TAttributeValue>[];\n\n public extensions: Extension<TExtensionValue>[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'PKCS#10 Certificate Request';\n\n public readonly tag = 'CERTIFICATE REQUEST';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), CertificationRequest);\n\n const { certificationRequestInfo } = this.asn;\n\n this.subject = new Name(certificationRequestInfo.subject).toJSON();\n this.version = certificationRequestInfo.version;\n }\n\n public get publicKey(): IPublicKey {\n const { subjectPublicKey, algorithm } = this.asn.certificationRequestInfo.subjectPKInfo;\n let params;\n\n if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {\n params = AsnConvert.parse(algorithm.parameters, ECParameters);\n }\n\n if (algorithm.algorithm === id_rsaEncryption) {\n params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);\n }\n\n const spki = AsnConvert.serialize(this.asn.certificationRequestInfo.subjectPKInfo);\n\n return {\n params,\n value: spki,\n algorithm: algorithm.algorithm,\n };\n }\n\n public get signature(): ISignature {\n const { signature, signatureAlgorithm } = this.asn;\n\n return {\n value: signature,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public get commonName(): string {\n if (!this.subject) {\n return '';\n }\n\n for (let i = 0; i < this.subject.length; i += 1) {\n const name = this.subject[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public parseAttributes() {\n const { certificationRequestInfo } = this.asn;\n\n if (certificationRequestInfo.attributes) {\n this.attributes = certificationRequestInfo.attributes\n .map((e) => new Attribute(AsnConvert.serialize(e)));\n\n const extensionRequestAttribute = this.attributes.find(\n (attribute) => attribute.asn.type === id_pkcs9_at_extensionRequest,\n ) as Attribute<ExtensionRequest>;\n\n if (extensionRequestAttribute) {\n this.extensions = extensionRequestAttribute.value\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.csr.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.csr.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
- import { A as AsnData, v as certificateRawToBuffer, K as Certificate, C as Convert_1, N as Name, L as dateDiff, G as Extension, y as AsnConvert, x as id_ecPublicKey, z as ECParameters, B as id_rsaEncryption, R as RSAPublicKey, M as id_composite_key, O as CompositePublicKey, P as id_alg_composite, Q as CompositeSignatureValue, S as CompositeParams, F as getCertificateThumbprint, H as base64Format, J as hexFormat, D as Download } from './certification_request-b531916a.js';
4
+ import { A as AsnData, v as certificateRawToBuffer, K as Certificate, C as Convert_1, N as Name, L as dateDiff, G as Extension, y as AsnConvert, x as id_ecPublicKey, z as ECParameters, B as id_rsaEncryption, R as RSAPublicKey, M as id_composite_key, O as CompositePublicKey, P as id_alg_composite, Q as CompositeSignatureValue, S as CompositeParams, F as getCertificateThumbprint, H as base64Format, J as hexFormat, D as Download } from './certification_request-a4699dcf.js';
5
5
 
6
6
  /**
7
7
  * @license
@@ -156,4 +156,4 @@ class X509Certificate extends AsnData {
156
156
 
157
157
  export { X509Certificate as X };
158
158
 
159
- //# sourceMappingURL=x509_certificate-050175dd.js.map
159
+ //# sourceMappingURL=x509_certificate-05a23c0e.js.map
@@ -1 +1 @@
1
- {"file":"x509_certificate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AC,IAAI,MACR,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE,CAClC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;KACf;IAEM,QAAQ,CAAC,SAAmC,KAAK;QACtD,QAAQ,MAAM;YACZ,KAAK,KAAK;gBACR,OAAO,SAAS,CAACA,SAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,KAAK,KAAK;gBACR,OAAO,cAAc,IAAI,CAAC,GAAG,UAAU,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,IAAI,CAAC,GAAG,OAAO,CAAC;YAC5G;gBACE,OAAOA,SAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;KACF;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,IAAI,CAAC,KAAK,CACjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,IAAI,CAAC,KAAK,CACjB,IAAI,CAAC,GAAG,EACR,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;;;;;","names":["Convert"],"sources":["src/crypto/x509_certificate.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { ECParameters, id_ecPublicKey } from '@peculiar/asn1-ecc';\nimport { id_rsaEncryption, RSAPublicKey } from '@peculiar/asn1-rsa';\nimport {\n id_composite_key,\n id_alg_composite,\n CompositePublicKey,\n CompositeSignatureValue,\n CompositeParams,\n} from '@peculiar/asn1-x509-post-quantum';\nimport { Certificate, SubjectPublicKeyInfo } from '@peculiar/asn1-x509';\nimport { Convert } from 'pvtsutils';\n\nimport { dateDiff, Download } from '../utils';\n\nimport { Name, INameJSON } from './name';\nimport { Extension, TExtensionValue } from './extension';\nimport { AsnData } from './asn_data';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\nexport interface ISignature {\n algorithm: string;\n value: BufferSource;\n params?: {\n algorithm: string;\n value: BufferSource;\n }[];\n}\n\nexport interface IPublicKey {\n algorithm: string;\n value: BufferSource;\n params?: ECParameters | RSAPublicKey | IPublicKey[];\n}\n\nexport class X509Certificate extends AsnData<Certificate> {\n public readonly serialNumber: string;\n\n public readonly subject: INameJSON[];\n\n public readonly issuer: INameJSON[];\n\n public readonly notBefore: Date;\n\n public readonly notAfter: Date;\n\n public readonly validity: string;\n\n public extensions: Extension<TExtensionValue>[];\n\n public readonly version: number;\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'X.509 Certificate';\n\n public readonly tag = 'CERTIFICATE';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), Certificate);\n\n const { tbsCertificate } = this.asn;\n\n this.serialNumber = Convert.ToHex(tbsCertificate.serialNumber);\n this.subject = new Name(tbsCertificate.subject).toJSON();\n this.issuer = new Name(tbsCertificate.issuer).toJSON();\n this.version = tbsCertificate.version + 1;\n\n const notBefore = tbsCertificate.validity.notBefore.utcTime\n || tbsCertificate.validity.notBefore.generalTime;\n\n if (!notBefore) {\n throw new Error(\"Cannot get 'notBefore' value\");\n }\n\n this.notBefore = notBefore;\n\n const notAfter = tbsCertificate.validity.notAfter.utcTime\n || tbsCertificate.validity.notAfter.generalTime;\n\n if (!notAfter) {\n throw new Error(\"Cannot get 'notAfter' value\");\n }\n\n this.notAfter = notAfter;\n this.validity = dateDiff(this.notBefore, this.notAfter);\n }\n\n public parseExtensions() {\n const { tbsCertificate } = this.asn;\n\n if (tbsCertificate.extensions) {\n this.extensions = tbsCertificate.extensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n private getPublicKeyInfo(publicKeyInfo: SubjectPublicKeyInfo) {\n const { subjectPublicKey, algorithm } = publicKeyInfo;\n let params;\n\n if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {\n params = AsnConvert.parse(algorithm.parameters, ECParameters);\n }\n\n if (algorithm.algorithm === id_rsaEncryption) {\n params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);\n }\n\n if (algorithm.algorithm === id_composite_key) {\n params = AsnConvert.parse(subjectPublicKey, CompositePublicKey);\n\n params = params.map((param) => this.getPublicKeyInfo(param));\n }\n\n const spki = AsnConvert.serialize(publicKeyInfo);\n\n return {\n params,\n value: spki,\n algorithm: algorithm.algorithm,\n };\n }\n\n public get publicKey(): IPublicKey {\n return this.getPublicKeyInfo(this.asn.tbsCertificate.subjectPublicKeyInfo);\n }\n\n public get signature(): ISignature {\n const { signatureValue, signatureAlgorithm } = this.asn;\n let params;\n\n if (signatureAlgorithm.algorithm === id_alg_composite) {\n const compositeSignatureValues = AsnConvert.parse(signatureValue, CompositeSignatureValue);\n const compositeParams = AsnConvert.parse(signatureAlgorithm.parameters, CompositeParams);\n\n params = compositeParams.map((param, index) => ({\n ...param,\n value: compositeSignatureValues[index],\n }));\n }\n\n return {\n params,\n value: signatureValue,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get commonName(): string {\n if (!this.subject) {\n return '';\n }\n\n for (let i = 0; i < this.subject.length; i += 1) {\n const name = this.subject[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public get issuerCommonName(): string {\n if (!this.issuer) {\n return '';\n }\n\n for (let i = 0; i < this.issuer.length; i += 1) {\n const name = this.issuer[i];\n\n if (name.shortName === 'CN') {\n return name.value;\n }\n\n if (name.shortName === 'E') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public get isRoot(): boolean {\n return JSON.stringify(this.issuer) === JSON.stringify(this.subject);\n }\n\n public subjectToString() {\n if (!this.subject) {\n return '';\n }\n\n return this.subject\n .map((name) => (\n `${name.shortName}=${name.value}`\n ))\n .join(', ');\n }\n\n public issuerToString() {\n if (!this.issuer) {\n return '';\n }\n\n return this.issuer\n .map((name) => (\n `${name.shortName}=${name.value}`\n ))\n .join(', ');\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.cert.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.cert.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n"],"version":3}
1
+ {"file":"x509_certificate-05a23c0e.js","mappings":";;;;;AAAA;;;;;;;MAgDa,eAAgB,SAAQ,OAAoB;IAuBvD,YAAY,GAAW;QACrB,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;QAP3C,gBAAW,GAA2B,EAAE,CAAC;QAEhC,SAAI,GAAG,mBAAmB,CAAC;QAE3B,QAAG,GAAG,aAAa,CAAC;QAKlC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAEpC,IAAI,CAAC,YAAY,GAAGA,SAAO,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QAC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CAAC;SACrC;KACF;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,IAAI,CAAC,KAAK,CACjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,IAAI,CAAC,KAAK,CACjB,IAAI,CAAC,GAAG,EACR,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;;;;;","names":["Convert"],"sources":["src/crypto/x509_certificate.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { ECParameters, id_ecPublicKey } from '@peculiar/asn1-ecc';\nimport { id_rsaEncryption, RSAPublicKey } from '@peculiar/asn1-rsa';\nimport {\n id_composite_key,\n id_alg_composite,\n CompositePublicKey,\n CompositeSignatureValue,\n CompositeParams,\n} from '@peculiar/asn1-x509-post-quantum';\nimport { Certificate, SubjectPublicKeyInfo } from '@peculiar/asn1-x509';\nimport { Convert } from 'pvtsutils';\n\nimport { dateDiff, Download } from '../utils';\n\nimport { Name, INameJSON } from './name';\nimport { Extension, TExtensionValue } from './extension';\nimport { AsnData } from './asn_data';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\nexport interface ISignature {\n algorithm: string;\n value: BufferSource;\n params?: {\n algorithm: string;\n value: BufferSource;\n }[];\n}\n\nexport interface IPublicKey {\n algorithm: string;\n value: BufferSource;\n params?: ECParameters | RSAPublicKey | IPublicKey[];\n}\n\nexport class X509Certificate extends AsnData<Certificate> {\n public readonly serialNumber: string;\n\n public readonly subject: INameJSON[];\n\n public readonly issuer: INameJSON[];\n\n public readonly notBefore: Date;\n\n public readonly notAfter: Date;\n\n public readonly validity: string;\n\n public extensions: Extension<TExtensionValue>[];\n\n public readonly version: number;\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'X.509 Certificate';\n\n public readonly tag = 'CERTIFICATE';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), Certificate);\n\n const { tbsCertificate } = this.asn;\n\n this.serialNumber = Convert.ToHex(tbsCertificate.serialNumber);\n this.subject = new Name(tbsCertificate.subject).toJSON();\n this.issuer = new Name(tbsCertificate.issuer).toJSON();\n this.version = tbsCertificate.version + 1;\n\n const notBefore = tbsCertificate.validity.notBefore.utcTime\n || tbsCertificate.validity.notBefore.generalTime;\n\n if (!notBefore) {\n throw new Error(\"Cannot get 'notBefore' value\");\n }\n\n this.notBefore = notBefore;\n\n const notAfter = tbsCertificate.validity.notAfter.utcTime\n || tbsCertificate.validity.notAfter.generalTime;\n\n if (!notAfter) {\n throw new Error(\"Cannot get 'notAfter' value\");\n }\n\n this.notAfter = notAfter;\n this.validity = dateDiff(this.notBefore, this.notAfter);\n }\n\n public parseExtensions() {\n const { tbsCertificate } = this.asn;\n\n if (tbsCertificate.extensions) {\n this.extensions = tbsCertificate.extensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n private getPublicKeyInfo(publicKeyInfo: SubjectPublicKeyInfo) {\n const { subjectPublicKey, algorithm } = publicKeyInfo;\n let params;\n\n if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {\n params = AsnConvert.parse(algorithm.parameters, ECParameters);\n }\n\n if (algorithm.algorithm === id_rsaEncryption) {\n params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);\n }\n\n if (algorithm.algorithm === id_composite_key) {\n params = AsnConvert.parse(subjectPublicKey, CompositePublicKey);\n\n params = params.map((param) => this.getPublicKeyInfo(param));\n }\n\n const spki = AsnConvert.serialize(publicKeyInfo);\n\n return {\n params,\n value: spki,\n algorithm: algorithm.algorithm,\n };\n }\n\n public get publicKey(): IPublicKey {\n return this.getPublicKeyInfo(this.asn.tbsCertificate.subjectPublicKeyInfo);\n }\n\n public get signature(): ISignature {\n const { signatureValue, signatureAlgorithm } = this.asn;\n let params;\n\n if (signatureAlgorithm.algorithm === id_alg_composite) {\n const compositeSignatureValues = AsnConvert.parse(signatureValue, CompositeSignatureValue);\n const compositeParams = AsnConvert.parse(signatureAlgorithm.parameters, CompositeParams);\n\n params = compositeParams.map((param, index) => ({\n ...param,\n value: compositeSignatureValues[index],\n }));\n }\n\n return {\n params,\n value: signatureValue,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get commonName(): string {\n if (!this.subject) {\n return '';\n }\n\n for (let i = 0; i < this.subject.length; i += 1) {\n const name = this.subject[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public get issuerCommonName(): string {\n if (!this.issuer) {\n return '';\n }\n\n for (let i = 0; i < this.issuer.length; i += 1) {\n const name = this.issuer[i];\n\n if (name.shortName === 'CN') {\n return name.value;\n }\n\n if (name.shortName === 'E') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public get isRoot(): boolean {\n return JSON.stringify(this.issuer) === JSON.stringify(this.subject);\n }\n\n public subjectToString() {\n if (!this.subject) {\n return '';\n }\n\n return this.subject\n .map((name) => (\n `${name.shortName}=${name.value}`\n ))\n .join(', ');\n }\n\n public issuerToString() {\n if (!this.issuer) {\n return '';\n }\n\n return this.issuer\n .map((name) => (\n `${name.shortName}=${name.value}`\n ))\n .join(', ');\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.cert.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.cert.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n"],"version":3}
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
- import { A as AsnData, v as certificateRawToBuffer, X as AttributeCertificate, C as Convert_1, L as dateDiff, G as Extension, y as AsnConvert, F as getCertificateThumbprint, H as base64Format, J as hexFormat, D as Download, Y as CertificateList, N as Name } from './certification_request-b531916a.js';
5
- import { A as Attribute } from './pkcs10_certificate_request-cca2ca68.js';
4
+ import { A as AsnData, v as certificateRawToBuffer, X as AttributeCertificate, C as Convert_1, L as dateDiff, G as Extension, y as AsnConvert, F as getCertificateThumbprint, H as base64Format, J as hexFormat, D as Download, Y as CertificateList, N as Name } from './certification_request-a4699dcf.js';
5
+ import { A as Attribute } from './pkcs10_certificate_request-785a4794.js';
6
6
 
7
7
  /**
8
8
  * @license
@@ -173,4 +173,4 @@ class X509Crl extends AsnData {
173
173
 
174
174
  export { X509AttributeCertificate as X, X509Crl as a };
175
175
 
176
- //# sourceMappingURL=x509_crl-c497f907.js.map
176
+ //# sourceMappingURL=x509_crl-26081461.js.map
@@ -1 +1 @@
1
- {"file":"x509_crl-c497f907.js","mappings":";;;;;;AAAA;;;;;;;MA8Ba,wBAAyB,SAAQ,OAA6B;IAyBzE,YAAY,GAAW;;QACrB,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAXpD,gBAAW,GAA2B,EAAE,CAAC;QAMhC,SAAI,GAAG,6BAA6B,CAAC;QAErC,QAAG,GAAG,uBAAuB,CAAC;QAK5C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAE5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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;KACF;IAEM,QAAQ,CAAC,SAAmC,KAAK;QACtD,QAAQ,MAAM;YACZ,KAAK,KAAK;gBACR,OAAO,SAAS,CAACA,SAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,KAAK,KAAK;gBACR,OAAO,cAAc,IAAI,CAAC,GAAG,UAAU,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,IAAI,CAAC,GAAG,OAAO,CAAC;YAC5G;gBACE,OAAOA,SAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;KACF;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,GAAG,EACR,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;;;;;","names":["Convert"],"sources":["src/crypto/x509_attribute_certificate.ts","src/crypto/x509_crl.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport type { GeneralName } from '@peculiar/asn1-x509';\nimport { AttributeCertificate, Holder } from '@peculiar/asn1-x509-attr';\nimport { Convert } from 'pvtsutils';\n\nimport { dateDiff, Download } from '../utils';\n\nimport { AsnData } from './asn_data';\nimport { Extension, TExtensionValue } from './extension';\nimport { Attribute, TAttributeValue } from './attribute';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\nexport class X509AttributeCertificate extends AsnData<AttributeCertificate> {\n public readonly serialNumber: string;\n\n public readonly version: number;\n\n public readonly notBefore: Date;\n\n public readonly notAfter: Date;\n\n public readonly validity: string;\n\n public extensions: Extension<TExtensionValue>[];\n\n public attributes: Attribute<TAttributeValue>[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly issuer: GeneralName[];\n\n public holder: Holder;\n\n public readonly type = 'X.509 Attribute Certificate';\n\n public readonly tag = 'ATTRIBUTE CERTIFICATE';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), AttributeCertificate);\n\n const { acinfo } = this.asn;\n\n this.serialNumber = Convert.ToHex(acinfo.serialNumber);\n this.version = acinfo.version;\n\n const notBefore = acinfo.attrCertValidityPeriod.notBeforeTime;\n\n if (!notBefore) {\n throw new Error(\"Cannot get 'notBefore' value\");\n }\n\n this.notBefore = notBefore;\n\n const notAfter = acinfo.attrCertValidityPeriod.notAfterTime;\n\n if (!notAfter) {\n throw new Error(\"Cannot get 'notAfter' value\");\n }\n\n this.notAfter = notAfter;\n this.validity = dateDiff(this.notBefore, this.notAfter);\n this.issuer = acinfo.issuer.v1Form || acinfo.issuer.v2Form?.issuerName;\n this.holder = acinfo.holder;\n }\n\n public get signature(): ISignature {\n const { signatureValue, signatureAlgorithm } = this.asn;\n\n return {\n value: signatureValue,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public parseExtensions() {\n const { acinfo } = this.asn;\n\n if (acinfo.extensions) {\n this.extensions = acinfo.extensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n public parseAttributes() {\n const { acinfo } = this.asn;\n\n if (acinfo.attributes) {\n this.attributes = acinfo.attributes\n .map((e) => new Attribute(AsnConvert.serialize(e)));\n }\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get commonName(): string {\n return `attribute-certificate-${this.thumbprints['SHA-1']}`;\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.attrCert.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.attrCert.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n","/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { CertificateList, Time } from '@peculiar/asn1-x509';\nimport { Convert } from 'pvtsutils';\n\nimport { Download } from '../utils';\n\nimport { Extension, TExtensionValue } from './extension';\nimport { AsnData } from './asn_data';\nimport { Name, INameJSON } from './name';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\nexport interface IRevokedCertificate {\n userCertificate: ArrayBuffer;\n revocationDate: Time;\n crlEntryExtensions?: Extension<TExtensionValue>[];\n}\n\nexport class X509Crl extends AsnData<CertificateList> {\n public readonly issuer: INameJSON[];\n\n public readonly version: number;\n\n public readonly lastUpdate: Date;\n\n public readonly nextUpdate: Date;\n\n public extensions: Extension<TExtensionValue>[];\n\n public revokedCertificates: IRevokedCertificate[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'X.509 Certificate Revocation List';\n\n public readonly tag = 'X509 CRL';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), CertificateList);\n\n const { tbsCertList } = this.asn;\n\n this.issuer = new Name(tbsCertList.issuer).toJSON();\n this.version = tbsCertList.version + 1;\n this.lastUpdate = tbsCertList.thisUpdate.getTime();\n this.nextUpdate = tbsCertList.nextUpdate.getTime();\n\n this.revokedCertificates = (tbsCertList.revokedCertificates || [])\n .map((revokedCertificate) => ({\n revocationDate: revokedCertificate.revocationDate,\n userCertificate: revokedCertificate.userCertificate,\n crlEntryExtensions: revokedCertificate.crlEntryExtensions\n ?.map((e) => new Extension(AsnConvert.serialize(e))),\n }));\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get signature(): ISignature {\n const { signature, signatureAlgorithm } = this.asn;\n\n return {\n value: signature,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public get commonName(): string {\n if (!this.issuer) {\n return '';\n }\n\n for (let i = 0; i < this.issuer.length; i += 1) {\n const name = this.issuer[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public parseExtensions() {\n const { tbsCertList } = this.asn;\n\n if (tbsCertList.crlExtensions) {\n this.extensions = tbsCertList.crlExtensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.crl.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.crl.asDER(\n this.raw,\n name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AC,SAAS,KAAK,GAAG,IAAI,IAAI,CAAC,SAAS,KAAK,GAAG,EAAE;gBAC/E,OAAO,IAAI,CAAC,KAAK,CAAC;aACnB;SACF;QAED,OAAO,EAAE,CAAC;KACX;IAEM,eAAe;QACpB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAEjC,IAAI,WAAW,CAAC,aAAa,EAAE;YAC7B,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,aAAa;iBACxC,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;KACF;IAEM,QAAQ,CAAC,SAAmC,KAAK;QACtD,QAAQ,MAAM;YACZ,KAAK,KAAK;gBACR,OAAO,SAAS,CAACA,SAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,KAAK,KAAK;gBACR,OAAO,cAAc,IAAI,CAAC,GAAG,UAAU,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,IAAI,CAAC,GAAG,OAAO,CAAC;YAC5G;gBACE,OAAOA,SAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrC;KACF;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;IAEM,aAAa,CAAC,IAAa;QAChC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAChB,IAAI,CAAC,GAAG,EACR,IAAI,IAAI,IAAI,CAAC,UAAU,CACxB,CAAC;KACH;;;;;","names":["Convert"],"sources":["src/crypto/x509_attribute_certificate.ts","src/crypto/x509_crl.ts"],"sourcesContent":["/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport type { GeneralName } from '@peculiar/asn1-x509';\nimport { AttributeCertificate, Holder } from '@peculiar/asn1-x509-attr';\nimport { Convert } from 'pvtsutils';\n\nimport { dateDiff, Download } from '../utils';\n\nimport { AsnData } from './asn_data';\nimport { Extension, TExtensionValue } from './extension';\nimport { Attribute, TAttributeValue } from './attribute';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\nexport class X509AttributeCertificate extends AsnData<AttributeCertificate> {\n public readonly serialNumber: string;\n\n public readonly version: number;\n\n public readonly notBefore: Date;\n\n public readonly notAfter: Date;\n\n public readonly validity: string;\n\n public extensions: Extension<TExtensionValue>[];\n\n public attributes: Attribute<TAttributeValue>[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly issuer: GeneralName[];\n\n public holder: Holder;\n\n public readonly type = 'X.509 Attribute Certificate';\n\n public readonly tag = 'ATTRIBUTE CERTIFICATE';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), AttributeCertificate);\n\n const { acinfo } = this.asn;\n\n this.serialNumber = Convert.ToHex(acinfo.serialNumber);\n this.version = acinfo.version;\n\n const notBefore = acinfo.attrCertValidityPeriod.notBeforeTime;\n\n if (!notBefore) {\n throw new Error(\"Cannot get 'notBefore' value\");\n }\n\n this.notBefore = notBefore;\n\n const notAfter = acinfo.attrCertValidityPeriod.notAfterTime;\n\n if (!notAfter) {\n throw new Error(\"Cannot get 'notAfter' value\");\n }\n\n this.notAfter = notAfter;\n this.validity = dateDiff(this.notBefore, this.notAfter);\n this.issuer = acinfo.issuer.v1Form || acinfo.issuer.v2Form?.issuerName;\n this.holder = acinfo.holder;\n }\n\n public get signature(): ISignature {\n const { signatureValue, signatureAlgorithm } = this.asn;\n\n return {\n value: signatureValue,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public parseExtensions() {\n const { acinfo } = this.asn;\n\n if (acinfo.extensions) {\n this.extensions = acinfo.extensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n public parseAttributes() {\n const { acinfo } = this.asn;\n\n if (acinfo.attributes) {\n this.attributes = acinfo.attributes\n .map((e) => new Attribute(AsnConvert.serialize(e)));\n }\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get commonName(): string {\n return `attribute-certificate-${this.thumbprints['SHA-1']}`;\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.attrCert.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.attrCert.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n","/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { AsnConvert } from '@peculiar/asn1-schema';\nimport { CertificateList, Time } from '@peculiar/asn1-x509';\nimport { Convert } from 'pvtsutils';\n\nimport { Download } from '../utils';\n\nimport { Extension, TExtensionValue } from './extension';\nimport { AsnData } from './asn_data';\nimport { Name, INameJSON } from './name';\nimport {\n certificateRawToBuffer,\n hexFormat,\n base64Format,\n getCertificateThumbprint,\n} from './utils';\n\ninterface ISignature {\n algorithm: string;\n value: BufferSource;\n}\n\nexport interface IRevokedCertificate {\n userCertificate: ArrayBuffer;\n revocationDate: Time;\n crlEntryExtensions?: Extension<TExtensionValue>[];\n}\n\nexport class X509Crl extends AsnData<CertificateList> {\n public readonly issuer: INameJSON[];\n\n public readonly version: number;\n\n public readonly lastUpdate: Date;\n\n public readonly nextUpdate: Date;\n\n public extensions: Extension<TExtensionValue>[];\n\n public revokedCertificates: IRevokedCertificate[];\n\n public thumbprints: Record<string, string> = {};\n\n public readonly type = 'X.509 Certificate Revocation List';\n\n public readonly tag = 'X509 CRL';\n\n constructor(raw: string) {\n super(certificateRawToBuffer(raw), CertificateList);\n\n const { tbsCertList } = this.asn;\n\n this.issuer = new Name(tbsCertList.issuer).toJSON();\n this.version = tbsCertList.version + 1;\n this.lastUpdate = tbsCertList.thisUpdate.getTime();\n this.nextUpdate = tbsCertList.nextUpdate.getTime();\n\n this.revokedCertificates = (tbsCertList.revokedCertificates || [])\n .map((revokedCertificate) => ({\n revocationDate: revokedCertificate.revocationDate,\n userCertificate: revokedCertificate.userCertificate,\n crlEntryExtensions: revokedCertificate.crlEntryExtensions\n ?.map((e) => new Extension(AsnConvert.serialize(e))),\n }));\n }\n\n public async getThumbprint(\n algorithm: string = 'SHA-1',\n ): Promise<void> {\n try {\n const thumbprint = await getCertificateThumbprint(algorithm, this.raw);\n\n if (thumbprint) {\n this.thumbprints[algorithm] = Convert.ToHex(thumbprint);\n }\n } catch (error) {\n console.error('Error thumbprint get:', error);\n }\n }\n\n public get signature(): ISignature {\n const { signature, signatureAlgorithm } = this.asn;\n\n return {\n value: signature,\n algorithm: signatureAlgorithm.algorithm,\n };\n }\n\n public get commonName(): string {\n if (!this.issuer) {\n return '';\n }\n\n for (let i = 0; i < this.issuer.length; i += 1) {\n const name = this.issuer[i];\n\n if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {\n return name.value;\n }\n }\n\n return '';\n }\n\n public parseExtensions() {\n const { tbsCertList } = this.asn;\n\n if (tbsCertList.crlExtensions) {\n this.extensions = tbsCertList.crlExtensions\n .map((e) => new Extension(AsnConvert.serialize(e)));\n }\n }\n\n public toString(format: 'hex' | 'pem' | 'base64' = 'pem'): string {\n switch (format) {\n case 'hex':\n return hexFormat(Convert.ToHex(this.raw));\n case 'pem':\n return `-----BEGIN ${this.tag}-----\\n${base64Format(this.toString('base64'))}\\n-----END ${this.tag}-----`;\n default:\n return Convert.ToBase64(this.raw);\n }\n }\n\n public downloadAsPEM(name?: string) {\n Download.crl.asPEM(\n this.toString('pem'),\n name || this.commonName,\n );\n }\n\n public downloadAsDER(name?: string) {\n Download.crl.asDER(\n this.raw,\n name || this.commonName,\n );\n }\n}\n"],"version":3}