@peculiar/certificates-viewer 4.2.1 → 4.3.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.
Files changed (227) hide show
  1. package/components/attribute-certificate-viewer.js +17 -14
  2. package/components/attribute-certificate-viewer.js.map +1 -1
  3. package/components/attribute.js +53 -0
  4. package/components/attribute.js.map +1 -0
  5. package/components/certificate-viewer.js +15 -13
  6. package/components/certificate-viewer.js.map +1 -1
  7. package/components/crl-viewer.js +20 -18
  8. package/components/crl-viewer.js.map +1 -1
  9. package/components/csr-viewer.js +9 -99
  10. package/components/csr-viewer.js.map +1 -1
  11. package/components/download.js +12518 -9
  12. package/components/download.js.map +1 -1
  13. package/components/index.js +2 -0
  14. package/components/index.js.map +1 -1
  15. package/components/index2.js +3 -48
  16. package/components/index2.js.map +1 -1
  17. package/components/issuer_name.js +2 -2
  18. package/components/miscellaneous.js +41 -12555
  19. package/components/miscellaneous.js.map +1 -1
  20. package/components/peculiar-certificate-decoder.js +17 -105
  21. package/components/peculiar-certificate-decoder.js.map +1 -1
  22. package/components/peculiar-certificates-viewer.js +1 -2
  23. package/components/peculiar-certificates-viewer.js.map +1 -1
  24. package/components/peculiar-crl-viewer.js +1 -1
  25. package/components/peculiar-csr-viewer.js +1 -1
  26. package/components/pkcs10_certificate_request.js +102 -0
  27. package/components/pkcs10_certificate_request.js.map +1 -0
  28. package/components/read_file.js +110 -0
  29. package/components/read_file.js.map +1 -0
  30. package/components/subject_name.js +2 -2
  31. package/dist/cjs/{certification_request-b0d72620.js → certification_request-314859bb.js} +3266 -2810
  32. package/dist/cjs/certification_request-314859bb.js.map +1 -0
  33. package/dist/cjs/index.cjs.js +12 -5
  34. package/dist/cjs/index.cjs.js.map +1 -1
  35. package/dist/cjs/{miscellaneous-dcb93a5b.js → miscellaneous-f1bc3a4b.js} +22 -23
  36. package/dist/cjs/miscellaneous-f1bc3a4b.js.map +1 -0
  37. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js +20 -20
  38. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js.map +1 -1
  39. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +20 -108
  40. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js.map +1 -1
  41. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +3 -4
  42. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js.map +1 -1
  43. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +2 -3
  44. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js.map +1 -1
  45. package/dist/cjs/pkcs10_certificate_request-93c66ce7.js +149 -0
  46. package/dist/cjs/pkcs10_certificate_request-93c66ce7.js.map +1 -0
  47. package/dist/cjs/read_file-2e22a97e.js +115 -0
  48. package/dist/cjs/read_file-2e22a97e.js.map +1 -0
  49. package/dist/cjs/{x509_certificate-ebf4cbd4.js → x509_certificate-0776e3ec.js} +17 -16
  50. package/dist/cjs/x509_certificate-0776e3ec.js.map +1 -0
  51. package/dist/cjs/x509_crl-5326d209.js +179 -0
  52. package/dist/cjs/x509_crl-5326d209.js.map +1 -0
  53. package/dist/collection/components/certificate-decoder/certificate-decoder.js +15 -72
  54. package/dist/collection/components/certificate-decoder/certificate-decoder.js.map +1 -1
  55. package/dist/collection/components/certificate-details-parts/miscellaneous.js.map +1 -1
  56. package/dist/collection/components/crl-viewer/crl-viewer.js +6 -6
  57. package/dist/collection/components/crl-viewer/crl-viewer.js.map +1 -1
  58. package/dist/collection/components/csr-viewer/csr-viewer.js +6 -6
  59. package/dist/collection/components/csr-viewer/csr-viewer.js.map +1 -1
  60. package/dist/collection/constants/oids.js +3 -0
  61. package/dist/collection/constants/oids.js.map +1 -1
  62. package/dist/collection/crypto/index.js +2 -2
  63. package/dist/collection/crypto/index.js.map +1 -1
  64. package/dist/collection/crypto/{csr.js → pkcs10_certificate_request.js} +14 -12
  65. package/dist/collection/crypto/pkcs10_certificate_request.js.map +1 -0
  66. package/dist/collection/crypto/x509_attribute_certificate.js +13 -11
  67. package/dist/collection/crypto/x509_attribute_certificate.js.map +1 -1
  68. package/dist/collection/crypto/x509_certificate.js +13 -11
  69. package/dist/collection/crypto/x509_certificate.js.map +1 -1
  70. package/dist/collection/crypto/{crl.js → x509_crl.js} +14 -12
  71. package/dist/collection/crypto/x509_crl.js.map +1 -0
  72. package/dist/collection/index.js +2 -0
  73. package/dist/collection/index.js.map +1 -1
  74. package/dist/collection/utils/download.js +8 -8
  75. package/dist/collection/utils/download.js.map +1 -1
  76. package/dist/collection/utils/validator.js +0 -8
  77. package/dist/collection/utils/validator.js.map +1 -1
  78. package/dist/esm/{certification_request-2c054ece.js → certification_request-b531916a.js} +3202 -2745
  79. package/dist/esm/certification_request-b531916a.js.map +1 -0
  80. package/dist/esm/index.js +3 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/{miscellaneous-0e98b5bc.js → miscellaneous-7fe71e3f.js} +2 -3
  83. package/dist/esm/miscellaneous-7fe71e3f.js.map +1 -0
  84. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js +12 -12
  85. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -1
  86. package/dist/esm/peculiar-certificate-decoder.entry.js +18 -106
  87. package/dist/esm/peculiar-certificate-decoder.entry.js.map +1 -1
  88. package/dist/esm/peculiar-certificate-viewer.entry.js +3 -4
  89. package/dist/esm/peculiar-certificate-viewer.entry.js.map +1 -1
  90. package/dist/esm/peculiar-certificates-viewer.entry.js +2 -3
  91. package/dist/esm/peculiar-certificates-viewer.entry.js.map +1 -1
  92. package/dist/esm/pkcs10_certificate_request-cca2ca68.js +146 -0
  93. package/dist/esm/pkcs10_certificate_request-cca2ca68.js.map +1 -0
  94. package/dist/esm/read_file-bb0b1450.js +110 -0
  95. package/dist/esm/read_file-bb0b1450.js.map +1 -0
  96. package/dist/esm/{x509_certificate-ad568d3a.js → x509_certificate-050175dd.js} +15 -14
  97. package/dist/esm/x509_certificate-050175dd.js.map +1 -0
  98. package/dist/esm/x509_crl-c497f907.js +176 -0
  99. package/dist/esm/x509_crl-c497f907.js.map +1 -0
  100. package/dist/esm-es5/{certification_request-2c054ece.js → certification_request-b531916a.js} +61 -23
  101. package/dist/esm-es5/certification_request-b531916a.js.map +1 -0
  102. package/dist/esm-es5/index.js +1 -1
  103. package/dist/esm-es5/{miscellaneous-0e98b5bc.js → miscellaneous-7fe71e3f.js} +2 -2
  104. package/dist/esm-es5/{miscellaneous-0e98b5bc.js.map → miscellaneous-7fe71e3f.js.map} +1 -1
  105. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js +2 -2
  106. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -1
  107. package/dist/esm-es5/peculiar-certificate-decoder.entry.js +2 -9
  108. package/dist/esm-es5/peculiar-certificate-decoder.entry.js.map +1 -1
  109. package/dist/esm-es5/peculiar-certificate-viewer.entry.js +2 -2
  110. package/dist/esm-es5/peculiar-certificate-viewer.entry.js.map +1 -1
  111. package/dist/esm-es5/peculiar-certificates-viewer.entry.js +1 -1
  112. package/dist/esm-es5/pkcs10_certificate_request-cca2ca68.js +19 -0
  113. package/dist/esm-es5/pkcs10_certificate_request-cca2ca68.js.map +1 -0
  114. package/dist/esm-es5/read_file-bb0b1450.js +12 -0
  115. package/dist/esm-es5/read_file-bb0b1450.js.map +1 -0
  116. package/dist/esm-es5/x509_certificate-050175dd.js +12 -0
  117. package/dist/esm-es5/x509_certificate-050175dd.js.map +1 -0
  118. package/dist/esm-es5/x509_crl-c497f907.js +19 -0
  119. package/dist/esm-es5/x509_crl-c497f907.js.map +1 -0
  120. package/dist/peculiar/index.esm.js +1 -1
  121. package/dist/peculiar/p-05af3b74.system.js +13 -0
  122. package/dist/peculiar/p-05af3b74.system.js.map +1 -0
  123. package/dist/peculiar/p-163a3052.system.js +20 -0
  124. package/dist/peculiar/p-163a3052.system.js.map +1 -0
  125. package/dist/peculiar/p-25a532a3.js +12 -0
  126. package/dist/peculiar/p-25a532a3.js.map +1 -0
  127. package/dist/peculiar/{p-5cf4562f.system.entry.js → p-2d9c40d6.system.entry.js} +16 -16
  128. package/dist/peculiar/p-2d9c40d6.system.entry.js.map +1 -0
  129. package/dist/peculiar/p-494d26fb.entry.js +5 -0
  130. package/dist/peculiar/p-494d26fb.entry.js.map +1 -0
  131. package/dist/peculiar/{p-ff3ced3c.system.js → p-52f13c4a.system.js} +45 -45
  132. package/dist/peculiar/{p-ff3ced3c.system.js.map → p-52f13c4a.system.js.map} +1 -1
  133. package/dist/peculiar/p-55303453.system.js +12 -0
  134. package/dist/peculiar/p-55303453.system.js.map +1 -0
  135. package/dist/peculiar/p-5a699274.js +19 -0
  136. package/dist/peculiar/p-5a699274.js.map +1 -0
  137. package/dist/peculiar/p-6221d0a4.system.entry.js +5 -0
  138. package/dist/peculiar/p-6221d0a4.system.entry.js.map +1 -0
  139. package/dist/peculiar/p-666438a8.js +135 -0
  140. package/dist/peculiar/p-666438a8.js.map +1 -0
  141. package/dist/peculiar/{p-c23fd001.entry.js → p-7a5173be.entry.js} +16 -16
  142. package/dist/peculiar/p-7a5173be.entry.js.map +1 -0
  143. package/dist/peculiar/p-80477c05.js +12 -0
  144. package/dist/peculiar/p-80477c05.js.map +1 -0
  145. package/dist/peculiar/p-8393399a.system.js +1 -1
  146. package/dist/peculiar/p-8ff95ad8.entry.js +5 -0
  147. package/dist/peculiar/{p-54b37ef9.entry.js.map → p-8ff95ad8.entry.js.map} +1 -1
  148. package/dist/peculiar/p-a06f51a2.system.js +19 -0
  149. package/dist/peculiar/p-a06f51a2.system.js.map +1 -0
  150. package/dist/peculiar/{p-75166532.js → p-adf16adb.js} +21 -21
  151. package/dist/peculiar/{p-75166532.js.map → p-adf16adb.js.map} +1 -1
  152. package/dist/peculiar/p-b6d5e413.js +19 -0
  153. package/dist/peculiar/p-b6d5e413.js.map +1 -0
  154. package/dist/peculiar/p-bd7fb688.system.entry.js +5 -0
  155. package/dist/peculiar/{p-00302a20.system.entry.js.map → p-bd7fb688.system.entry.js.map} +1 -1
  156. package/dist/peculiar/{p-496449cf.system.entry.js → p-cc256004.system.entry.js} +2 -2
  157. package/dist/peculiar/p-d1066b51.system.js +135 -0
  158. package/dist/peculiar/p-d1066b51.system.js.map +1 -0
  159. package/dist/peculiar/p-d6229f42.system.js +5 -0
  160. package/dist/peculiar/{p-5f3b0fc7.entry.js → p-ddadcb44.entry.js} +3 -3
  161. package/dist/peculiar/peculiar.esm.js +1 -1
  162. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +3 -3
  163. package/dist/types/components/certificate-details-parts/miscellaneous.d.ts +2 -2
  164. package/dist/types/components/crl-viewer/crl-viewer.d.ts +2 -2
  165. package/dist/types/components/csr-viewer/csr-viewer.d.ts +2 -2
  166. package/dist/types/constants/oids.d.ts +3 -0
  167. package/dist/types/crypto/index.d.ts +2 -2
  168. package/dist/types/crypto/{csr.d.ts → pkcs10_certificate_request.d.ts} +4 -5
  169. package/dist/types/crypto/x509_attribute_certificate.d.ts +3 -4
  170. package/dist/types/crypto/x509_certificate.d.ts +3 -4
  171. package/dist/types/crypto/{crl.d.ts → x509_crl.d.ts} +4 -5
  172. package/dist/types/index.d.ts +2 -0
  173. package/dist/types/utils/download.d.ts +4 -4
  174. package/dist/types/utils/validator.d.ts +0 -4
  175. package/hydrate/index.js +84 -138
  176. package/package.json +4 -4
  177. package/dist/cjs/certification_request-b0d72620.js.map +0 -1
  178. package/dist/cjs/crl-812dd7a1.js +0 -312
  179. package/dist/cjs/crl-812dd7a1.js.map +0 -1
  180. package/dist/cjs/download-6f550549.js +0 -476
  181. package/dist/cjs/download-6f550549.js.map +0 -1
  182. package/dist/cjs/miscellaneous-dcb93a5b.js.map +0 -1
  183. package/dist/cjs/x509_certificate-ebf4cbd4.js.map +0 -1
  184. package/dist/collection/crypto/crl.js.map +0 -1
  185. package/dist/collection/crypto/csr.js.map +0 -1
  186. package/dist/esm/certification_request-2c054ece.js.map +0 -1
  187. package/dist/esm/crl-a7318483.js +0 -308
  188. package/dist/esm/crl-a7318483.js.map +0 -1
  189. package/dist/esm/download-8c128e2e.js +0 -470
  190. package/dist/esm/download-8c128e2e.js.map +0 -1
  191. package/dist/esm/miscellaneous-0e98b5bc.js.map +0 -1
  192. package/dist/esm/x509_certificate-ad568d3a.js.map +0 -1
  193. package/dist/esm-es5/certification_request-2c054ece.js.map +0 -1
  194. package/dist/esm-es5/crl-a7318483.js +0 -33
  195. package/dist/esm-es5/crl-a7318483.js.map +0 -1
  196. package/dist/esm-es5/download-8c128e2e.js +0 -43
  197. package/dist/esm-es5/download-8c128e2e.js.map +0 -1
  198. package/dist/esm-es5/x509_certificate-ad568d3a.js +0 -12
  199. package/dist/esm-es5/x509_certificate-ad568d3a.js.map +0 -1
  200. package/dist/peculiar/p-00302a20.system.entry.js +0 -5
  201. package/dist/peculiar/p-0dbc8238.system.js +0 -13
  202. package/dist/peculiar/p-0dbc8238.system.js.map +0 -1
  203. package/dist/peculiar/p-1302bd67.js +0 -97
  204. package/dist/peculiar/p-1302bd67.js.map +0 -1
  205. package/dist/peculiar/p-1f766dd5.js +0 -43
  206. package/dist/peculiar/p-1f766dd5.js.map +0 -1
  207. package/dist/peculiar/p-3d44cbd2.js +0 -12
  208. package/dist/peculiar/p-3d44cbd2.js.map +0 -1
  209. package/dist/peculiar/p-3f9af5f5.system.js +0 -97
  210. package/dist/peculiar/p-3f9af5f5.system.js.map +0 -1
  211. package/dist/peculiar/p-54b37ef9.entry.js +0 -5
  212. package/dist/peculiar/p-5c6f9a14.entry.js +0 -12
  213. package/dist/peculiar/p-5c6f9a14.entry.js.map +0 -1
  214. package/dist/peculiar/p-5cf4562f.system.entry.js.map +0 -1
  215. package/dist/peculiar/p-6680f277.system.entry.js +0 -13
  216. package/dist/peculiar/p-6680f277.system.entry.js.map +0 -1
  217. package/dist/peculiar/p-924790f5.js +0 -33
  218. package/dist/peculiar/p-924790f5.js.map +0 -1
  219. package/dist/peculiar/p-b2890eb8.system.js +0 -5
  220. package/dist/peculiar/p-c156b495.system.js +0 -33
  221. package/dist/peculiar/p-c156b495.system.js.map +0 -1
  222. package/dist/peculiar/p-c23fd001.entry.js.map +0 -1
  223. package/dist/peculiar/p-dde511c8.system.js +0 -43
  224. package/dist/peculiar/p-dde511c8.system.js.map +0 -1
  225. /package/dist/peculiar/{p-496449cf.system.entry.js.map → p-cc256004.system.entry.js.map} +0 -0
  226. /package/dist/peculiar/{p-b2890eb8.system.js.map → p-d6229f42.system.js.map} +0 -0
  227. /package/dist/peculiar/{p-5f3b0fc7.entry.js.map → p-ddadcb44.entry.js.map} +0 -0
@@ -1,12 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,a){function o(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function c(e){try{n(a.next(e))}catch(e){i(e)}}function s(e){try{n(a["throw"](e))}catch(e){i(e)}}function n(e){e.done?r(e.value):o(e.value).then(c,s)}n((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,o,i,c;return c={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function s(e){return function(t){return n([e,t])}}function n(s){if(a)throw new TypeError("Generator is already executing.");while(c&&(c=0,s[0]&&(r=0)),r)try{if(a=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];o=0}finally{a=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(t,e,r,a){function o(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,c){function i(t){try{s(a.next(t))}catch(t){c(t)}}function n(t){try{s(a["throw"](t))}catch(t){c(t)}}function s(t){t.done?r(t.value):o(t.value).then(i,n)}s((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,o,c,i;return i={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function n(t){return function(e){return s([t,e])}}function s(n){if(a)throw new TypeError("Generator is already executing.");while(i&&(i=0,n[0]&&(r=0)),r)try{if(a=1,o&&(c=n[0]&2?o["return"]:n[0]?o["throw"]||((c=o["return"])&&c.call(o),0):o.next)&&!(c=c.call(o,n[1])).done)return c;if(o=0,c)n=[n[0]&2,c.value];switch(n[0]){case 0:case 1:c=n;break;case 4:r.label++;return{value:n[1],done:false};case 5:r.label++;o=n[1];n=[0];continue;case 7:n=r.ops.pop();r.trys.pop();continue;default:if(!(c=r.trys,c=c.length>0&&c[c.length-1])&&(n[0]===6||n[0]===2)){r=0;continue}if(n[0]===3&&(!c||n[1]>c[0]&&n[1]<c[3])){r.label=n[1];break}if(n[0]===6&&r.label<c[1]){r.label=c[1];c=n;break}if(c&&r.label<c[2]){r.label=c[2];r.ops.push(n);break}if(c[2])r.ops.pop();r.trys.pop();continue}n=e.call(t,r)}catch(t){n=[6,t];o=0}finally{a=c=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
4
- */import{r as registerInstance,c as createEvent,h,H as Host}from"./index-ae188432.js";import{i as isPem,a as isX509Pem,b as isPkcs10Pem,c as isX509AttributePem,d as isX509CRLPem}from"./certification_request-2c054ece.js";import"./download-8c128e2e.js";import{X as X509Certificate}from"./x509_certificate-ad568d3a.js";import{X as X509AttributeCertificate,C as CSR,a as CRL}from"./crl-a7318483.js";import{T as Typography,B as Button}from"./button-a2fabf9a.js";
5
- /**
6
- * @license
7
- * Copyright (c) Peculiar Ventures, LLC.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */function readAsBinaryString(e){return new Promise((function(t,r){var a=new FileReader;a.onload=function(){return t({value:a.result,fileName:e.name,fileSize:e.size,sourceMime:e.type})};a.onerror=function(){return r(a.error)};a.readAsBinaryString(e)}))}var 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)}";var PeculiarCertificateDecoderStyle0=certificateDecoderCss;var CertificateDecoder=function(){function e(e){var t=this;registerInstance(this,e);this.successParse=createEvent(this,"successParse",7);this.clearCertificate=createEvent(this,"clearCertificate",7);this.handleClickDecode=function(){var e=t.inputPaste.value;if(e){t.decode(e)}};this.handleClickClear=function(){t.clearValue()};this.handleChangeInputFile=function(e){return __awaiter(t,void 0,void 0,(function(){var t,r;return __generator(this,(function(a){switch(a.label){case 0:t=e.target;if(!t.files)return[3,2];return[4,readAsBinaryString(t.files[0])];case 1:r=a.sent();if(typeof r.value==="string"){this.decode(r.value)}t.value="";a.label=2;case 2:return[2]}}))}))};this.handleChangeExample=function(e){if(e.target.value){t.decode(e.target.value)}else{t.clearValue()}};this.handleDropFile=function(e){return __awaiter(t,void 0,void 0,(function(){var t,r;return __generator(this,(function(a){switch(a.label){case 0:e.stopPropagation();e.preventDefault();t=e.dataTransfer;if(!t.files)return[3,2];return[4,readAsBinaryString(t.files[0])];case 1:r=a.sent();if(typeof r.value==="string"){this.decode(r.value)}a.label=2;case 2:return[2]}}))}))};this.certificateExamples=undefined;this.defaultCertificate=undefined;this.certificateDecoded=undefined}e.prototype.componentDidLoad=function(){var e=this;if(this.defaultCertificate){setTimeout((function(){return e.decode(e.defaultCertificate)}),100)}};e.prototype.clearValue=function(){this.inputPaste.value="";this.certificateDecoded=null;this.clearCertificate.emit()};e.prototype.setValue=function(e){this.certificateDecoded=e;this.inputPaste.value=e.exportAsPemFormatted();this.successParse.emit(e.exportAsBase64())};e.prototype.decode=function(e){var t=isPem(e);var r=isX509Pem(e);var a=isPkcs10Pem(e);var o=isX509AttributePem(e);var i=isX509CRLPem(e);var c;var s;if(t&&!(r||o||a||i)){this.clearValue();alert("Unsupported file type. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.");return}try{if(r){c=new X509Certificate(e)}if(o){c=new X509AttributeCertificate(e)}if(a){c=new CSR(e)}if(i){c=new CRL(e)}}catch(e){s=e}if(!c){try{c=new X509Certificate(e)}catch(e){s=e}}if(!c){try{c=new X509AttributeCertificate(e)}catch(e){s=e}}if(!c){try{c=new CSR(e)}catch(e){s=e}}if(!c){try{c=new CRL(e)}catch(e){s=e}}if(!c){this.clearValue();console.log(s);alert("Error decoding file. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.")}else{this.setValue(c)}};e.prototype.render=function(){var e=this;var t;return h(Host,{key:"b10e5ce1d2efe26bbe7e0daafb3bbaf5a9f73a62"},h("textarea",{key:"581e7c2eadf2fe33876106b2fdc90bdc9fb92096",placeholder:"Certificate DER or PEM",class:"textarea t-b2 c-black",ref:function(t){e.inputPaste=t},onDrop:this.handleDropFile}),h("div",{key:"71f93ecef6e3571d3ca795be1b53e1b19c4881d3",class:"controls"},h("div",{key:"b2f2dfbe0637d3119bbb2dbf622f7614685f5cb5",class:"control_row"},h(Typography,{key:"c639c7c696d589ef1035ca8c0f910ce5456e83cf",variant:"b3",color:"secondary-tint-2"},"Drag or load file:"),h("input",{key:"c8acf8a1620a802fbcf9afe6b52d8bed1e90bd23",type:"file",accept:"application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl",onChange:this.handleChangeInputFile,value:""})),((t=this.certificateExamples)===null||t===void 0?void 0:t.length)&&h("div",{class:"control_row"},h(Typography,{variant:"b3",color:"secondary-tint-2"},"Load examples:"),h("select",{onChange:this.handleChangeExample},h("option",{value:""},"None"),this.certificateExamples.map((function(e){return h("option",{value:e.value},e.title)})))),h("div",{key:"051ce823203fa7bf2a5f4e2c85b121017fdd8651",class:"control_row"},h(Button,{key:"405a0894a87ab000e3717cecd7d3fa34620c26a9",onClick:this.handleClickDecode},"Decode"),h(Button,{key:"34282cb209b5fb99a29b2b415435d31646fe0e7e",onClick:this.handleClickClear},"Clear"))),this.certificateDecoded instanceof X509Certificate&&h("peculiar-certificate-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof X509AttributeCertificate&&h("peculiar-attribute-certificate-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof CSR&&h("peculiar-csr-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof CRL&&h("peculiar-crl-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}))};return e}();CertificateDecoder.style=PeculiarCertificateDecoderStyle0;export{CertificateDecoder as peculiar_certificate_decoder};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host}from"./index-ae188432.js";import{a as readAsBinaryString}from"./read_file-bb0b1450.js";import"./certification_request-b531916a.js";import{X as X509Certificate}from"./x509_certificate-050175dd.js";import{X as X509AttributeCertificate,a as X509Crl}from"./x509_crl-c497f907.js";import{P as Pkcs10CertificateRequest}from"./pkcs10_certificate_request-cca2ca68.js";import{T as Typography,B as Button}from"./button-a2fabf9a.js";var 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)}";var PeculiarCertificateDecoderStyle0=certificateDecoderCss;var CertificateDecoder=function(){function t(t){var e=this;registerInstance(this,t);this.successParse=createEvent(this,"successParse",7);this.clearCertificate=createEvent(this,"clearCertificate",7);this.handleClickDecode=function(){var t=e.inputPaste.value;if(t){e.decode(t)}};this.handleClickClear=function(){e.clearValue()};this.handleChangeInputFile=function(t){return __awaiter(e,void 0,void 0,(function(){var e,r;return __generator(this,(function(a){switch(a.label){case 0:e=t.target;if(!e.files)return[3,2];return[4,readAsBinaryString(e.files[0])];case 1:r=a.sent();if(typeof r.value==="string"){this.decode(r.value)}e.value="";a.label=2;case 2:return[2]}}))}))};this.handleChangeExample=function(t){if(t.target.value){e.decode(t.target.value)}else{e.clearValue()}};this.handleDropFile=function(t){return __awaiter(e,void 0,void 0,(function(){var e,r;return __generator(this,(function(a){switch(a.label){case 0:t.stopPropagation();t.preventDefault();e=t.dataTransfer;if(!e.files)return[3,2];return[4,readAsBinaryString(e.files[0])];case 1:r=a.sent();if(typeof r.value==="string"){this.decode(r.value)}a.label=2;case 2:return[2]}}))}))};this.certificateExamples=undefined;this.defaultCertificate=undefined;this.certificateDecoded=undefined}t.prototype.componentDidLoad=function(){var t=this;if(this.defaultCertificate){setTimeout((function(){return t.decode(t.defaultCertificate)}),100)}};t.prototype.clearValue=function(){this.inputPaste.value="";this.certificateDecoded=null;this.clearCertificate.emit()};t.prototype.setValue=function(t){this.certificateDecoded=t;this.inputPaste.value=t.toString("pem");this.successParse.emit(t.toString("base64"))};t.prototype.decode=function(t){var e=this;new Promise((function(e){e(new X509Certificate(t))})).catch((function(){return new X509AttributeCertificate(t)})).catch((function(){return new Pkcs10CertificateRequest(t)})).catch((function(){return new X509Crl(t)})).then((function(t){return e.setValue(t)})).catch((function(t){e.clearValue();console.log(t);alert("Error decoding file. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.")}))};t.prototype.render=function(){var t=this;var e;return h(Host,{key:"7c3bfca68882e39705e9640f76754cce2e5d6c6a"},h("textarea",{key:"4d24f4b914f7f118efde2144e7597e0767d59ce8",placeholder:"Certificate DER or PEM",class:"textarea t-b2 c-black",ref:function(e){t.inputPaste=e},onDrop:this.handleDropFile}),h("div",{key:"06ba6e2b5658225a585ec9711e6f3f945ef3a840",class:"controls"},h("div",{key:"df2e115ea04d4eae7985f6ee57bfe47354f50240",class:"control_row"},h(Typography,{key:"05c30b2956055455cdb1f52b40995752dd0d7da4",variant:"b3",color:"secondary-tint-2"},"Drag or load file:"),h("input",{key:"cca59d7c59d9917e728f9795bcfbd546d4cf75b8",type:"file",accept:"application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl",onChange:this.handleChangeInputFile,value:""})),((e=this.certificateExamples)===null||e===void 0?void 0:e.length)&&h("div",{class:"control_row"},h(Typography,{variant:"b3",color:"secondary-tint-2"},"Load examples:"),h("select",{onChange:this.handleChangeExample},h("option",{value:""},"None"),this.certificateExamples.map((function(t){return h("option",{value:t.value},t.title)})))),h("div",{key:"6d1f010e03d7836459214e5c0abe1af7fbbe2a10",class:"control_row"},h(Button,{key:"4038db36b62ff11f592f380f5c98bebb0014585e",onClick:this.handleClickDecode},"Decode"),h(Button,{key:"fb7c30e61b10194b5f02a2cefa06191904f5ce46",onClick:this.handleClickClear},"Clear"))),this.certificateDecoded instanceof X509Certificate&&h("peculiar-certificate-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof X509AttributeCertificate&&h("peculiar-attribute-certificate-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof Pkcs10CertificateRequest&&h("peculiar-csr-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}),this.certificateDecoded instanceof X509Crl&&h("peculiar-crl-viewer",{certificate:this.certificateDecoded,class:"viewer",download:true}))};return t}();CertificateDecoder.style=PeculiarCertificateDecoderStyle0;export{CertificateDecoder as peculiar_certificate_decoder};
12
5
  //# sourceMappingURL=peculiar-certificate-decoder.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["readAsBinaryString","file","Promise","resolve","reject","reader","FileReader","onload","value","result","fileName","name","fileSize","size","sourceMime","type","onerror","error","certificateDecoderCss","PeculiarCertificateDecoderStyle0","CertificateDecoder","this","handleClickDecode","_this","inputPaste","decode","handleClickClear","clearValue","handleChangeInputFile","event","__awaiter","element","target","files","_b","sent","handleChangeExample","handleDropFile","stopPropagation","preventDefault","dataTransfer","class_1","prototype","componentDidLoad","defaultCertificate","setTimeout","certificateDecoded","clearCertificate","emit","setValue","exportAsPemFormatted","successParse","exportAsBase64","certificate","isPem","validator.isPem","isX509Pem","validator.isX509Pem","isPkcs10Pem","validator.isPkcs10Pem","isX509AttributePem","validator.isX509AttributePem","isX509CRLPem","validator.isX509CRLPem","decoded","decodeError","alert","X509Certificate","X509AttributeCertificate","CSR","CRL","console","log","render","h","Host","key","placeholder","class","ref","el","onDrop","Typography","variant","color","accept","onChange","_a","certificateExamples","length","map","example","title","Button","onClick","download"],"sources":["src/utils/read_file.ts","src/components/certificate-decoder/certificate-decoder.scss?tag=peculiar-certificate-decoder&encapsulation=shadow","src/components/certificate-decoder/certificate-decoder.tsx"],"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\nexport type FileValue = string | ArrayBuffer | null;\nexport interface IFileDataType extends Blob {\n name?: string;\n mimeType?: string;\n lastModified?: number;\n}\nexport interface IReadFileResult {\n value: FileValue;\n fileName: string | undefined;\n fileSize: number | undefined;\n sourceMime: string | undefined;\n}\n\n/**\n * Read file as Binary string\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsBinaryString(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsBinaryString(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsBinaryString(file);\n });\n}\n\n/**\n * Read file as ArrayBuffer\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsArrayBuffer(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsArrayBuffer(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsArrayBuffer(file);\n });\n}\n\n/**\n * Read file as Data URL\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsDataUrl(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsDataUrl(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Read file as Text\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsText(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsText(file: IFileDataType, options?: string): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsText(file, options);\n });\n}\n","@import '../../css/base.scss';\n\n:host {\n display: block;\n width: 100%;\n}\n\n.textarea {\n min-height: 300px;\n width: 100%;\n border-radius: 4px;\n border: 1px solid var(--pv-color-gray-5);;\n padding: 14px;\n font-family: monospace;\n resize: vertical;\n}\n\n.viewer {\n margin-top: var(--pv-size-base-12);\n}\n\n.controls {\n margin-top: var(--pv-size-base-2);\n display: flex;\n flex-direction: column;\n gap: var(--pv-size-base-2);\n}\n\n.control_row {\n display: flex;\n align-items: center;\n gap: var(--pv-size-base);\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 {\n Component,\n Host,\n h,\n State,\n Prop,\n Event,\n EventEmitter,\n} from '@stencil/core';\n\nimport { validator, readAsBinaryString } from '../../utils';\nimport {\n X509Certificate,\n X509AttributeCertificate,\n CSR,\n CRL,\n} from '../../crypto';\nimport { Button } from '../button';\nimport { Typography } from '../typography';\n\n@Component({\n tag: 'peculiar-certificate-decoder',\n styleUrl: 'certificate-decoder.scss',\n shadow: true,\n})\nexport class CertificateDecoder {\n private inputPaste?: HTMLTextAreaElement;\n\n /**\n * The example certificate value for decode and show details. Use PEM or DER.\n */\n @Prop() certificateExamples?: {\n title: string;\n value: string;\n }[];\n\n /**\n * The default certificate value for decode and show details. Use PEM or DER.\n */\n @Prop() defaultCertificate?: string;\n\n @State() certificateDecoded: X509Certificate | X509AttributeCertificate | CSR | CRL;\n\n /**\n * Emitted when the certificate has been successfully parsed.\n */\n @Event() successParse!: EventEmitter<string>;\n\n /**\n * Emitted when the certificate has been removed.\n */\n @Event() clearCertificate!: EventEmitter<void>;\n\n componentDidLoad() {\n if (this.defaultCertificate) {\n /**\n * Prevent Stencil warning about re-render\n */\n setTimeout(() => this.decode(this.defaultCertificate), 100);\n }\n }\n\n private handleClickDecode = () => {\n const { value } = this.inputPaste;\n\n if (value) {\n this.decode(value);\n }\n };\n\n private handleClickClear = () => {\n this.clearValue();\n };\n\n private handleChangeInputFile = async (event: any) => {\n const element = event.target;\n\n if (element.files) {\n const file = await readAsBinaryString(element.files[0]);\n\n if (typeof file.value === 'string') {\n this.decode(file.value);\n }\n\n element.value = '';\n }\n };\n\n private handleChangeExample = (event: any) => {\n if (event.target.value) {\n this.decode(event.target.value);\n } else {\n this.clearValue();\n }\n };\n\n private handleDropFile = async (event: any) => {\n event.stopPropagation();\n event.preventDefault();\n\n const element = event.dataTransfer;\n\n if (element.files) {\n const file = await readAsBinaryString(element.files[0]);\n\n if (typeof file.value === 'string') {\n this.decode(file.value);\n }\n }\n };\n\n clearValue() {\n this.inputPaste.value = '';\n this.certificateDecoded = null;\n this.clearCertificate.emit();\n }\n\n setValue(value: X509Certificate | X509AttributeCertificate | CSR | CRL) {\n this.certificateDecoded = value;\n this.inputPaste.value = value.exportAsPemFormatted();\n this.successParse.emit(value.exportAsBase64());\n }\n\n decode(certificate: string) {\n const isPem = validator.isPem(certificate);\n const isX509Pem = validator.isX509Pem(certificate);\n const isPkcs10Pem = validator.isPkcs10Pem(certificate);\n const isX509AttributePem = validator.isX509AttributePem(certificate);\n const isX509CRLPem = validator.isX509CRLPem(certificate);\n let decoded: X509Certificate | X509AttributeCertificate | CSR | CRL;\n let decodeError: Error;\n\n if (isPem && !(isX509Pem || isX509AttributePem || isPkcs10Pem || isX509CRLPem)) {\n this.clearValue();\n\n alert('Unsupported file type. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.');\n\n return;\n }\n\n try {\n if (isX509Pem) {\n decoded = new X509Certificate(certificate);\n }\n\n if (isX509AttributePem) {\n decoded = new X509AttributeCertificate(certificate);\n }\n\n if (isPkcs10Pem) {\n decoded = new CSR(certificate);\n }\n\n if (isX509CRLPem) {\n decoded = new CRL(certificate);\n }\n } catch (error) {\n decodeError = error;\n }\n\n if (!decoded) {\n try {\n decoded = new X509Certificate(certificate);\n } catch (error) {\n decodeError = error;\n }\n }\n\n if (!decoded) {\n try {\n decoded = new X509AttributeCertificate(certificate);\n } catch (error) {\n decodeError = error;\n }\n }\n\n if (!decoded) {\n try {\n decoded = new CSR(certificate);\n } catch (error) {\n decodeError = error;\n }\n }\n\n if (!decoded) {\n try {\n decoded = new CRL(certificate);\n } catch (error) {\n decodeError = error;\n }\n }\n\n if (!decoded) {\n this.clearValue();\n\n console.log(decodeError);\n alert('Error decoding file. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.');\n } else {\n this.setValue(decoded);\n }\n }\n\n render() {\n return (\n <Host>\n <textarea\n placeholder=\"Certificate DER or PEM\"\n class=\"textarea t-b2 c-black\"\n ref={(el) => { this.inputPaste = el; }}\n onDrop={this.handleDropFile}\n />\n <div class=\"controls\">\n <div class=\"control_row\">\n <Typography\n variant=\"b3\"\n color=\"secondary-tint-2\"\n >\n Drag or load file:\n </Typography>\n <input\n type=\"file\"\n accept=\"application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl\"\n onChange={this.handleChangeInputFile}\n value=\"\"\n />\n </div>\n {this.certificateExamples?.length && (\n <div class=\"control_row\">\n <Typography\n variant=\"b3\"\n color=\"secondary-tint-2\"\n >\n Load examples:\n </Typography>\n <select onChange={this.handleChangeExample}>\n <option value=\"\">None</option>\n {this.certificateExamples.map((example) => (\n <option value={example.value}>\n {example.title}\n </option>\n ))}\n </select>\n </div>\n )}\n <div class=\"control_row\">\n <Button\n onClick={this.handleClickDecode}\n >\n Decode\n </Button>\n <Button\n onClick={this.handleClickClear}\n >\n Clear\n </Button>\n </div>\n </div>\n {this.certificateDecoded instanceof X509Certificate && (\n <peculiar-certificate-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof X509AttributeCertificate && (\n <peculiar-attribute-certificate-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof CSR && (\n <peculiar-csr-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof CRL && (\n <peculiar-crl-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;;;;;YAiCgBA,mBAAmBC,GACjC,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IAAMC,EAAS,IAAIC,WAEnBD,EAAOE,OAAS,WAAM,OAAAJ,EAAQ,CAC5BK,MAAOH,EAAOI,OACdC,SAAUT,EAAKU,KACfC,SAAUX,EAAKY,KACfC,WAAYb,EAAKc,MAJG,EAOtBV,EAAOW,QAAU,WAAM,OAAAZ,EAAOC,EAAOY,MAAd,EAEvBZ,EAAOL,mBAAmBC,E,GAE9B,CChDA,IAAMiB,sBAAwB,knQAC9B,IAAAC,iCAAeD,sB,ICgCFE,mBAAkB,W,oKAqCrBC,KAAAC,kBAAoB,WAClB,IAAAd,EAAUe,EAAKC,WAAUhB,MAEjC,GAAIA,EAAO,CACTe,EAAKE,OAAOjB,E,GAIRa,KAAAK,iBAAmB,WACzBH,EAAKI,Y,EAGCN,KAAAO,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ACE7D,KAAK,OACLsE,OAAO,uIACPC,SAAUjE,KAAKO,sBACfpB,MAAM,QAGT+E,EAAAlE,KAAKmE,uBAAmB,MAAAD,SAAA,SAAAA,EAAEE,SACzBf,EAAA,OAAKI,MAAM,eACTJ,EAACQ,WAAU,CACTC,QAAQ,KACRC,MAAM,oBAAkB,kBAI1BV,EAAA,UAAQY,SAAUjE,KAAKe,qBACrBsC,EAAA,UAAQlE,MAAM,IAAE,QACfa,KAAKmE,oBAAoBE,KAAI,SAACC,GAAO,OACpCjB,EAAA,UAAQlE,MAAOmF,EAAQnF,OACpBmF,EAAQC,MAFyB,MAQ5ClB,EAAA,OAAAE,IAAA,2CAAKE,MAAM,eACTJ,EAACmB,OAAM,CAAAjB,IAAA,2CACLkB,QAASzE,KAAKC,mBAAiB,UAIjCoD,EAACmB,OAAM,CAAAjB,IAAA,2CACLkB,QAASzE,KAAKK,kBAAgB,WAMnCL,KAAKyB,8BAA8BqB,iBAClCO,EAAA,+BACErB,YAAahC,KAAKyB,mBAClBgC,MAAM,SACNiB,SAAQ,OAGX1E,KAAKyB,8BAA8BsB,0BAClCM,EAAA,yCACErB,YAAahC,KAAKyB,mBAClBgC,MAAM,SACNiB,SAAQ,OAGX1E,KAAKyB,8BAA8BuB,KAClCK,EAAA,uBACErB,YAAahC,KAAKyB,mBAClBgC,MAAM,SACNiB,SAAQ,OAGX1E,KAAKyB,8BAA8BwB,KAClCI,EAAA,uBACErB,YAAahC,KAAKyB,mBAClBgC,MAAM,SACNiB,SAAQ,O,WAjQW,G"}
1
+ {"version":3,"names":["certificateDecoderCss","PeculiarCertificateDecoderStyle0","CertificateDecoder","this","handleClickDecode","value","_this","inputPaste","decode","handleClickClear","clearValue","handleChangeInputFile","event","__awaiter","element","target","files","readAsBinaryString","file","_b","sent","handleChangeExample","handleDropFile","stopPropagation","preventDefault","dataTransfer","class_1","prototype","componentDidLoad","defaultCertificate","setTimeout","certificateDecoded","clearCertificate","emit","setValue","toString","successParse","certificate","Promise","resolve","X509Certificate","catch","X509AttributeCertificate","Pkcs10CertificateRequest","X509Crl","then","res","err","console","log","alert","render","h","Host","key","placeholder","class","ref","el","onDrop","Typography","variant","color","type","accept","onChange","_a","certificateExamples","length","map","example","title","Button","onClick","download"],"sources":["src/components/certificate-decoder/certificate-decoder.scss?tag=peculiar-certificate-decoder&encapsulation=shadow","src/components/certificate-decoder/certificate-decoder.tsx"],"sourcesContent":["@import '../../css/base.scss';\n\n:host {\n display: block;\n width: 100%;\n}\n\n.textarea {\n min-height: 300px;\n width: 100%;\n border-radius: 4px;\n border: 1px solid var(--pv-color-gray-5);;\n padding: 14px;\n font-family: monospace;\n resize: vertical;\n}\n\n.viewer {\n margin-top: var(--pv-size-base-12);\n}\n\n.controls {\n margin-top: var(--pv-size-base-2);\n display: flex;\n flex-direction: column;\n gap: var(--pv-size-base-2);\n}\n\n.control_row {\n display: flex;\n align-items: center;\n gap: var(--pv-size-base);\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 {\n Component,\n Host,\n h,\n State,\n Prop,\n Event,\n EventEmitter,\n} from '@stencil/core';\n\nimport { readAsBinaryString } from '../../utils';\nimport {\n X509Certificate,\n X509AttributeCertificate,\n Pkcs10CertificateRequest,\n X509Crl,\n} from '../../crypto';\nimport { Button } from '../button';\nimport { Typography } from '../typography';\n\n@Component({\n tag: 'peculiar-certificate-decoder',\n styleUrl: 'certificate-decoder.scss',\n shadow: true,\n})\nexport class CertificateDecoder {\n private inputPaste?: HTMLTextAreaElement;\n\n /**\n * The example certificate value for decode and show details. Use PEM or DER.\n */\n @Prop() certificateExamples?: {\n title: string;\n value: string;\n }[];\n\n /**\n * The default certificate value for decode and show details. Use PEM or DER.\n */\n @Prop() defaultCertificate?: string;\n\n @State() certificateDecoded: X509Certificate\n | X509AttributeCertificate\n | Pkcs10CertificateRequest\n | X509Crl;\n\n /**\n * Emitted when the certificate has been successfully parsed.\n */\n @Event() successParse!: EventEmitter<string>;\n\n /**\n * Emitted when the certificate has been removed.\n */\n @Event() clearCertificate!: EventEmitter<void>;\n\n componentDidLoad() {\n if (this.defaultCertificate) {\n /**\n * Prevent Stencil warning about re-render\n */\n setTimeout(() => this.decode(this.defaultCertificate), 100);\n }\n }\n\n private handleClickDecode = () => {\n const { value } = this.inputPaste;\n\n if (value) {\n this.decode(value);\n }\n };\n\n private handleClickClear = () => {\n this.clearValue();\n };\n\n private handleChangeInputFile = async (event: any) => {\n const element = event.target;\n\n if (element.files) {\n const file = await readAsBinaryString(element.files[0]);\n\n if (typeof file.value === 'string') {\n this.decode(file.value);\n }\n\n element.value = '';\n }\n };\n\n private handleChangeExample = (event: any) => {\n if (event.target.value) {\n this.decode(event.target.value);\n } else {\n this.clearValue();\n }\n };\n\n private handleDropFile = async (event: any) => {\n event.stopPropagation();\n event.preventDefault();\n\n const element = event.dataTransfer;\n\n if (element.files) {\n const file = await readAsBinaryString(element.files[0]);\n\n if (typeof file.value === 'string') {\n this.decode(file.value);\n }\n }\n };\n\n clearValue() {\n this.inputPaste.value = '';\n this.certificateDecoded = null;\n this.clearCertificate.emit();\n }\n\n setValue(value: typeof this.certificateDecoded) {\n this.certificateDecoded = value;\n this.inputPaste.value = value.toString('pem');\n this.successParse.emit(value.toString('base64'));\n }\n\n decode(certificate: string) {\n new Promise((resolve) => {\n resolve(new X509Certificate(certificate));\n })\n .catch(() => new X509AttributeCertificate(certificate))\n .catch(() => new Pkcs10CertificateRequest(certificate))\n .catch(() => new X509Crl(certificate))\n .then((res: typeof this.certificateDecoded) => this.setValue(res))\n .catch((err) => {\n this.clearValue();\n\n console.log(err);\n alert('Error decoding file. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.');\n });\n }\n\n render() {\n return (\n <Host>\n <textarea\n placeholder=\"Certificate DER or PEM\"\n class=\"textarea t-b2 c-black\"\n ref={(el) => { this.inputPaste = el; }}\n onDrop={this.handleDropFile}\n />\n <div class=\"controls\">\n <div class=\"control_row\">\n <Typography\n variant=\"b3\"\n color=\"secondary-tint-2\"\n >\n Drag or load file:\n </Typography>\n <input\n type=\"file\"\n accept=\"application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl\"\n onChange={this.handleChangeInputFile}\n value=\"\"\n />\n </div>\n {this.certificateExamples?.length && (\n <div class=\"control_row\">\n <Typography\n variant=\"b3\"\n color=\"secondary-tint-2\"\n >\n Load examples:\n </Typography>\n <select onChange={this.handleChangeExample}>\n <option value=\"\">None</option>\n {this.certificateExamples.map((example) => (\n <option value={example.value}>\n {example.title}\n </option>\n ))}\n </select>\n </div>\n )}\n <div class=\"control_row\">\n <Button\n onClick={this.handleClickDecode}\n >\n Decode\n </Button>\n <Button\n onClick={this.handleClickClear}\n >\n Clear\n </Button>\n </div>\n </div>\n {this.certificateDecoded instanceof X509Certificate && (\n <peculiar-certificate-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof X509AttributeCertificate && (\n <peculiar-attribute-certificate-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof Pkcs10CertificateRequest && (\n <peculiar-csr-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n {this.certificateDecoded instanceof X509Crl && (\n <peculiar-crl-viewer\n certificate={this.certificateDecoded}\n class=\"viewer\"\n download\n />\n )}\n </Host>\n );\n }\n}\n"],"mappings":";;;keAAA,IAAMA,sBAAwB,knQAC9B,IAAAC,iCAAeD,sB,ICgCFE,mBAAkB,W,oKAwCrBC,KAAAC,kBAAoB,WAClB,IAAAC,EAAUC,EAAKC,WAAUF,MAEjC,GAAIA,EAAO,CACTC,EAAKE,OAAOH,E,GAIRF,KAAAM,iBAAmB,WACzBH,EAAKI,Y,EAGCP,KAAAQ,sBAAwB,SAAOC,GAAU,OAAAC,UAAAP,OAAA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,yCACEf,YAAalC,KAAK4B,mBAClByB,MAAM,SACNkB,SAAQ,OAGXvE,KAAK4B,8BAA8BY,0BAClCS,EAAA,uBACEf,YAAalC,KAAK4B,mBAClByB,MAAM,SACNkB,SAAQ,OAGXvE,KAAK4B,8BAA8Ba,SAClCQ,EAAA,uBACEf,YAAalC,KAAK4B,mBAClByB,MAAM,SACNkB,SAAQ,O,WArMW,G"}
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,r,a){function o(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,i){function s(t){try{c(a.next(t))}catch(t){i(t)}}function n(t){try{c(a["throw"](t))}catch(t){i(t)}}function c(t){t.done?r(t.value):o(t.value).then(s,n)}c((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,o,i,s;return s={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(t){return function(e){return c([t,e])}}function c(n){if(a)throw new TypeError("Generator is already executing.");while(s&&(s=0,n[0]&&(r=0)),r)try{if(a=1,o&&(i=n[0]&2?o["return"]:n[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,n[1])).done)return i;if(o=0,i)n=[n[0]&2,i.value];switch(n[0]){case 0:case 1:i=n;break;case 4:r.label++;return{value:n[1],done:false};case 5:r.label++;o=n[1];n=[0];continue;case 7:n=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(n[0]===6||n[0]===2)){r=0;continue}if(n[0]===3&&(!i||n[1]>i[0]&&n[1]<i[3])){r.label=n[1];break}if(n[0]===6&&r.label<i[1]){r.label=i[1];i=n;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(n);break}if(i[2])r.ops.pop();r.trys.pop();continue}n=e.call(t,r)}catch(t){n=[6,t];o=0}finally{a=i=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(t,e,r,a){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function s(t){try{c(a.next(t))}catch(t){o(t)}}function n(t){try{c(a["throw"](t))}catch(t){o(t)}}function c(t){t.done?r(t.value):i(t.value).then(s,n)}c((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a,i,o,s;return s={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(t){return function(e){return c([t,e])}}function c(n){if(a)throw new TypeError("Generator is already executing.");while(s&&(s=0,n[0]&&(r=0)),r)try{if(a=1,i&&(o=n[0]&2?i["return"]:n[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;if(i=0,o)n=[n[0]&2,o.value];switch(n[0]){case 0:case 1:o=n;break;case 4:r.label++;return{value:n[1],done:false};case 5:r.label++;i=n[1];n=[0];continue;case 7:n=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(n[0]===6||n[0]===2)){r=0;continue}if(n[0]===3&&(!o||n[1]>o[0]&&n[1]<o[3])){r.label=n[1];break}if(n[0]===6&&r.label<o[1]){r.label=o[1];o=n;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(n);break}if(o[2])r.ops.pop();r.trys.pop();continue}n=e.call(t,r)}catch(t){n=[6,t];i=0}finally{a=o=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
4
- */import{r as registerInstance,h,H as Host}from"./index-ae188432.js";import{X as X509Certificate}from"./x509_certificate-ad568d3a.js";import"./certification_request-2c054ece.js";import"./download-8c128e2e.js";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-0e98b5bc.js";import{T as Typography}from"./button-a2fabf9a.js";import"./link-7e4e9060.js";import"./download-14dc1047.js";var certificateViewerCss="*{-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%;position:relative;min-width:280px;min-height:300px;word-wrap:break-word;word-break:break-word}th,td{border:none}table{width:100%;border-spacing:0;border-collapse:collapse}table td{padding:var(--pv-size-base-2) var(--pv-size-base-4);vertical-align:top}table td:first-child{width:220px}table td:last-child{width:calc(100% - 220px)}table td.monospace{max-width:0}table td.divider{padding:var(--pv-size-base-2) 0}table td.divider span{height:1px;display:block;background-color:var(--pv-color-gray-4)}table .title td{padding-top:var(--pv-size-base-6);padding-bottom:var(--pv-size-base-2)}table table{border-left:1px solid var(--pv-color-gray-5)}.status_wrapper{min-height:inherit;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([data-mobile-screen-view=true]) table,:host([data-mobile-screen-view=true]) tr,:host([data-mobile-screen-view=true]) td{display:block}:host([data-mobile-screen-view=true]) table tr{padding:var(--pv-size-base-2) 0}:host([data-mobile-screen-view=true]) table tr.title{padding-top:var(--pv-size-base-6)}:host([data-mobile-screen-view=true]) table tr.title td{padding:0 var(--pv-size-base-4)}:host([data-mobile-screen-view=true]) table td{padding:0 var(--pv-size-base-4);width:100% !important;max-width:100% !important}:host([data-mobile-screen-view=true]) table td.divider{padding:0}";var PeculiarCertificateViewerStyle0=certificateViewerCss;var CertificateViewer=function(){function t(t){var e=this;registerInstance(this,t);this.getAuthKeyIdParentLink=function(t){var r;return(r=e.authKeyIdParentLink)===null||r===void 0?void 0:r.replace("{{authKeyId}}",t)};this.getAuthKeyIdSiblingsLink=function(t){var r;return(r=e.authKeyIdSiblingsLink)===null||r===void 0?void 0:r.replace("{{authKeyId}}",t)};this.getSubjectKeyIdChildrenLink=function(t){var r;return(r=e.subjectKeyIdChildrenLink)===null||r===void 0?void 0:r.replace("{{subjectKeyId}}",t)};this.getSubjectKeyIdSiblingsLink=function(t){var r;return(r=e.subjectKeyIdSiblingsLink)===null||r===void 0?void 0:r.replace("{{subjectKeyId}}",t)};this.certificate=undefined;this.download=undefined;this.authKeyIdParentLink=undefined;this.authKeyIdSiblingsLink=undefined;this.subjectKeyIdChildrenLink=undefined;this.subjectKeyIdSiblingsLink=undefined;this.issuerDnLink=undefined;this.mobileMediaQueryString="(max-width: 900px)";this.mobileScreenView=false;this.isDecodeInProcess=true}t.prototype.handleMediaQueryChange=function(t){this.mobileScreenView=t.matches};t.prototype.componentWillLoad=function(){this.decodeCertificate(this.certificate);{this.mobileMediaQuery=window.matchMedia(this.mobileMediaQueryString);this.mobileMediaQuery.addEventListener("change",this.handleMediaQueryChange.bind(this));this.mobileScreenView=this.mobileMediaQuery.matches}};t.prototype.disconnectedCallback=function(){this.mobileMediaQuery.removeEventListener("change",this.handleMediaQueryChange.bind(this))};t.prototype.decodeCertificate=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:this.isDecodeInProcess=true;r.label=1;case 1:r.trys.push([1,4,,5]);if(t instanceof X509Certificate){this.certificateDecoded=t}else if(typeof t==="string"){this.certificateDecoded=new X509Certificate(t)}else{return[2]}this.certificateDecoded.parseExtensions();return[4,this.certificateDecoded.getThumbprint("SHA-1")];case 2:r.sent();return[4,this.certificateDecoded.getThumbprint("SHA-256")];case 3:r.sent();return[3,5];case 4:e=r.sent();this.certificateDecodeError=e;console.error("Error certificate parse:",e);return[3,5];case 5:this.isDecodeInProcess=false;return[2]}}))}))};t.prototype.watchCertificateAndDecode=function(t,e){if(typeof t==="string"&&typeof e==="string"){if(t!==e){this.decodeCertificate(t)}return}if(t instanceof X509Certificate&&e instanceof X509Certificate){if(t.serialNumber!==e.serialNumber){this.decodeCertificate(t)}}};t.prototype.getIssuerDnLink=function(){return this.issuerDnLink};t.prototype.renderErrorState=function(){return h("div",{class:"status_wrapper"},h(Typography,null,"There was an error decoding this certificate."))};t.prototype.renderEmptyState=function(){return h("div",{class:"status_wrapper"},h(Typography,null,"There is no certificate available."))};t.prototype.render=function(){if(this.certificateDecodeError){return this.renderErrorState()}if(!this.certificateDecoded){return this.renderEmptyState()}return h(Host,{"data-mobile-screen-view":String(this.mobileScreenView)},h("table",null,h(BasicInformation,Object.assign({},this.certificateDecoded)),h(SubjectName,{name:this.certificateDecoded.subject}),h(IssuerName,{name:this.certificateDecoded.issuer,issuerDnLink:this.getIssuerDnLink()}),h(PublicKey,{publicKey:this.certificateDecoded.publicKey}),h(Signature,{signature:this.certificateDecoded.signature}),h(Thumbprints,{thumbprints:this.certificateDecoded.thumbprints}),h(Extensions,{extensions:this.certificateDecoded.extensions,getLEILink:getLEILink,getDNSNameLink:getDNSNameLink,getIPAddressLink:getIPAddressLink,getAuthKeyIdParentLink:this.getAuthKeyIdParentLink,getAuthKeyIdSiblingsLink:this.getAuthKeyIdSiblingsLink,getSubjectKeyIdChildrenLink:this.getSubjectKeyIdChildrenLink,getSubjectKeyIdSiblingsLink:this.getSubjectKeyIdSiblingsLink}),this.download&&h(Miscellaneous,{certificate:this.certificateDecoded})))};Object.defineProperty(t,"watchers",{get:function(){return{certificate:["watchCertificateAndDecode"]}},enumerable:false,configurable:true});return t}();CertificateViewer.style=PeculiarCertificateViewerStyle0;export{CertificateViewer as peculiar_certificate_viewer};
4
+ */import{r as registerInstance,h,H as Host}from"./index-ae188432.js";import{X as X509Certificate}from"./x509_certificate-050175dd.js";import"./certification_request-b531916a.js";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";import{T as Typography}from"./button-a2fabf9a.js";import"./link-7e4e9060.js";import"./download-14dc1047.js";var certificateViewerCss="*{-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%;position:relative;min-width:280px;min-height:300px;word-wrap:break-word;word-break:break-word}th,td{border:none}table{width:100%;border-spacing:0;border-collapse:collapse}table td{padding:var(--pv-size-base-2) var(--pv-size-base-4);vertical-align:top}table td:first-child{width:220px}table td:last-child{width:calc(100% - 220px)}table td.monospace{max-width:0}table td.divider{padding:var(--pv-size-base-2) 0}table td.divider span{height:1px;display:block;background-color:var(--pv-color-gray-4)}table .title td{padding-top:var(--pv-size-base-6);padding-bottom:var(--pv-size-base-2)}table table{border-left:1px solid var(--pv-color-gray-5)}.status_wrapper{min-height:inherit;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([data-mobile-screen-view=true]) table,:host([data-mobile-screen-view=true]) tr,:host([data-mobile-screen-view=true]) td{display:block}:host([data-mobile-screen-view=true]) table tr{padding:var(--pv-size-base-2) 0}:host([data-mobile-screen-view=true]) table tr.title{padding-top:var(--pv-size-base-6)}:host([data-mobile-screen-view=true]) table tr.title td{padding:0 var(--pv-size-base-4)}:host([data-mobile-screen-view=true]) table td{padding:0 var(--pv-size-base-4);width:100% !important;max-width:100% !important}:host([data-mobile-screen-view=true]) table td.divider{padding:0}";var PeculiarCertificateViewerStyle0=certificateViewerCss;var CertificateViewer=function(){function t(t){var e=this;registerInstance(this,t);this.getAuthKeyIdParentLink=function(t){var r;return(r=e.authKeyIdParentLink)===null||r===void 0?void 0:r.replace("{{authKeyId}}",t)};this.getAuthKeyIdSiblingsLink=function(t){var r;return(r=e.authKeyIdSiblingsLink)===null||r===void 0?void 0:r.replace("{{authKeyId}}",t)};this.getSubjectKeyIdChildrenLink=function(t){var r;return(r=e.subjectKeyIdChildrenLink)===null||r===void 0?void 0:r.replace("{{subjectKeyId}}",t)};this.getSubjectKeyIdSiblingsLink=function(t){var r;return(r=e.subjectKeyIdSiblingsLink)===null||r===void 0?void 0:r.replace("{{subjectKeyId}}",t)};this.certificate=undefined;this.download=undefined;this.authKeyIdParentLink=undefined;this.authKeyIdSiblingsLink=undefined;this.subjectKeyIdChildrenLink=undefined;this.subjectKeyIdSiblingsLink=undefined;this.issuerDnLink=undefined;this.mobileMediaQueryString="(max-width: 900px)";this.mobileScreenView=false;this.isDecodeInProcess=true}t.prototype.handleMediaQueryChange=function(t){this.mobileScreenView=t.matches};t.prototype.componentWillLoad=function(){this.decodeCertificate(this.certificate);{this.mobileMediaQuery=window.matchMedia(this.mobileMediaQueryString);this.mobileMediaQuery.addEventListener("change",this.handleMediaQueryChange.bind(this));this.mobileScreenView=this.mobileMediaQuery.matches}};t.prototype.disconnectedCallback=function(){this.mobileMediaQuery.removeEventListener("change",this.handleMediaQueryChange.bind(this))};t.prototype.decodeCertificate=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:this.isDecodeInProcess=true;r.label=1;case 1:r.trys.push([1,4,,5]);if(t instanceof X509Certificate){this.certificateDecoded=t}else if(typeof t==="string"){this.certificateDecoded=new X509Certificate(t)}else{return[2]}this.certificateDecoded.parseExtensions();return[4,this.certificateDecoded.getThumbprint("SHA-1")];case 2:r.sent();return[4,this.certificateDecoded.getThumbprint("SHA-256")];case 3:r.sent();return[3,5];case 4:e=r.sent();this.certificateDecodeError=e;console.error("Error certificate parse:",e);return[3,5];case 5:this.isDecodeInProcess=false;return[2]}}))}))};t.prototype.watchCertificateAndDecode=function(t,e){if(typeof t==="string"&&typeof e==="string"){if(t!==e){this.decodeCertificate(t)}return}if(t instanceof X509Certificate&&e instanceof X509Certificate){if(t.serialNumber!==e.serialNumber){this.decodeCertificate(t)}}};t.prototype.getIssuerDnLink=function(){return this.issuerDnLink};t.prototype.renderErrorState=function(){return h("div",{class:"status_wrapper"},h(Typography,null,"There was an error decoding this certificate."))};t.prototype.renderEmptyState=function(){return h("div",{class:"status_wrapper"},h(Typography,null,"There is no certificate available."))};t.prototype.render=function(){if(this.certificateDecodeError){return this.renderErrorState()}if(!this.certificateDecoded){return this.renderEmptyState()}return h(Host,{"data-mobile-screen-view":String(this.mobileScreenView)},h("table",null,h(BasicInformation,Object.assign({},this.certificateDecoded)),h(SubjectName,{name:this.certificateDecoded.subject}),h(IssuerName,{name:this.certificateDecoded.issuer,issuerDnLink:this.getIssuerDnLink()}),h(PublicKey,{publicKey:this.certificateDecoded.publicKey}),h(Signature,{signature:this.certificateDecoded.signature}),h(Thumbprints,{thumbprints:this.certificateDecoded.thumbprints}),h(Extensions,{extensions:this.certificateDecoded.extensions,getLEILink:getLEILink,getDNSNameLink:getDNSNameLink,getIPAddressLink:getIPAddressLink,getAuthKeyIdParentLink:this.getAuthKeyIdParentLink,getAuthKeyIdSiblingsLink:this.getAuthKeyIdSiblingsLink,getSubjectKeyIdChildrenLink:this.getSubjectKeyIdChildrenLink,getSubjectKeyIdSiblingsLink:this.getSubjectKeyIdSiblingsLink}),this.download&&h(Miscellaneous,{certificate:this.certificateDecoded})))};Object.defineProperty(t,"watchers",{get:function(){return{certificate:["watchCertificateAndDecode"]}},enumerable:false,configurable:true});return t}();CertificateViewer.style=PeculiarCertificateViewerStyle0;export{CertificateViewer as peculiar_certificate_viewer};
5
5
  //# sourceMappingURL=peculiar-certificate-viewer.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["certificateViewerCss","PeculiarCertificateViewerStyle0","CertificateViewer","this","getAuthKeyIdParentLink","value","_a","_this","authKeyIdParentLink","replace","getAuthKeyIdSiblingsLink","authKeyIdSiblingsLink","getSubjectKeyIdChildrenLink","subjectKeyIdChildrenLink","getSubjectKeyIdSiblingsLink","subjectKeyIdSiblingsLink","class_1","prototype","handleMediaQueryChange","event","mobileScreenView","matches","componentWillLoad","decodeCertificate","certificate","mobileMediaQuery","window","matchMedia","mobileMediaQueryString","addEventListener","bind","disconnectedCallback","removeEventListener","isDecodeInProcess","X509Certificate","certificateDecoded","parseExtensions","getThumbprint","_b","sent","certificateDecodeError","error_1","console","error","watchCertificateAndDecode","newValue","oldValue","serialNumber","getIssuerDnLink","issuerDnLink","renderErrorState","h","class","Typography","renderEmptyState","render","Host","String","BasicInformation","Object","assign","SubjectName","name","subject","IssuerName","issuer","PublicKey","publicKey","Signature","signature","Thumbprints","thumbprints","Extensions","extensions","getLEILink","getDNSNameLink","getIPAddressLink","download","Miscellaneous"],"sources":["src/components/certificate-viewer/certificate-viewer.scss?tag=peculiar-certificate-viewer&encapsulation=shadow","src/components/certificate-viewer/certificate-viewer.tsx"],"sourcesContent":["@import '../../css/base.scss';\n\n:host {\n display: block;\n width: 100%;\n position: relative;\n min-width: 280px;\n min-height: 300px;\n word-wrap: break-word;\n word-break: break-word;\n}\n\nth, td {\n border: none;\n}\n\ntable {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n\n td {\n padding: var(--pv-size-base-2) var(--pv-size-base-4);\n vertical-align: top;\n\n &:first-child {\n width: 220px;\n }\n\n &:last-child {\n width: calc(100% - 220px)\n }\n\n &.monospace {\n max-width: 0;\n }\n\n &.divider {\n padding: var(--pv-size-base-2) 0;\n\n span {\n height: 1px;\n display: block;\n background-color: var(--pv-color-gray-4);\n }\n }\n }\n\n .title td {\n padding-top: var(--pv-size-base-6);\n padding-bottom: var(--pv-size-base-2);\n }\n\n table {\n border-left: 1px solid var(--pv-color-gray-5);\n }\n}\n\n.status_wrapper {\n min-height: inherit;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n:host([data-mobile-screen-view=\"true\"]) {\n table, tr, td {\n display: block;\n }\n\n table {\n tr {\n padding: var(--pv-size-base-2) 0;\n\n &.title {\n padding-top: var(--pv-size-base-6);\n\n td {\n padding: 0 var(--pv-size-base-4);\n }\n }\n }\n\n td {\n padding: 0 var(--pv-size-base-4);\n width: 100% !important;\n max-width: 100% !important;\n\n &.divider {\n padding: 0;\n }\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 {\n Component,\n h,\n Prop,\n State,\n Watch,\n Host,\n Build,\n} from '@stencil/core';\n\nimport {\n X509Certificate,\n} from '../../crypto';\nimport { getDNSNameLink, getIPAddressLink, getLEILink } from '../../utils/third_party_links';\nimport {\n BasicInformation,\n SubjectName,\n IssuerName,\n PublicKey,\n Signature,\n Thumbprints,\n Extensions,\n Miscellaneous,\n} from '../certificate-details-parts';\nimport { Typography } from '../typography';\n\nexport type CertificateProp = string | X509Certificate;\n\n@Component({\n tag: 'peculiar-certificate-viewer',\n styleUrl: 'certificate-viewer.scss',\n shadow: true,\n})\nexport class CertificateViewer {\n private certificateDecoded: X509Certificate;\n\n private certificateDecodeError: Error;\n\n private mobileMediaQuery: MediaQueryList;\n\n /**\n * The certificate value for decode and show details. Use PEM or DER.\n */\n @Prop({ reflect: true }) certificate: CertificateProp;\n\n /**\n * If `true` - component will show split-button to download certificate as PEM or DER.\n */\n @Prop({ reflect: true }) download?: boolean;\n\n /**\n * Authority Key Identifier extension parent link.\n * <br />\n * **NOTE**: `{{authKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.subject_key_id:%20{{authKeyId}}\n */\n @Prop({ reflect: true }) authKeyIdParentLink?: string;\n\n /**\n * Authority Key Identifier extension siblings link.\n * <br />\n * **NOTE**: `{{authKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.authority_key_id:%20{{authKeyId}}\n */\n @Prop({ reflect: true }) authKeyIdSiblingsLink?: string;\n\n /**\n * Subject Key Identifier extension children link.\n * <br />\n * **NOTE**: `{{subjectKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.authority_key_id:%20{{subjectKeyId}}\n */\n @Prop({ reflect: true }) subjectKeyIdChildrenLink?: string;\n\n /**\n * Subject Key Identifier extension siblings link.\n * <br />\n * **NOTE**: `{{subjectKeyId}}` will be replaced to value from the extension.\n * @example\n * https://some.com/{{subjectKeyId}}\n */\n @Prop({ reflect: true }) subjectKeyIdSiblingsLink?: string;\n\n /**\n * Issuer DN link.\n * **NOTE**: HTML component attribute must be `issuer-dn-link`.\n */\n @Prop({ reflect: true }) issuerDnLink?: string;\n\n /**\n * Mobile media query string to control screen view change.\n * <br />\n * **NOTE**: Based on https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia.\n * @example\n * (max-width: 900px)\n */\n @Prop({ reflect: false }) mobileMediaQueryString?: string = '(max-width: 900px)';\n\n @State() mobileScreenView: boolean = false;\n\n @State() isDecodeInProcess: boolean = true;\n\n private handleMediaQueryChange(event: MediaQueryListEvent) {\n this.mobileScreenView = event.matches;\n }\n\n componentWillLoad() {\n this.decodeCertificate(this.certificate);\n\n if (Build.isBrowser) {\n this.mobileMediaQuery = window.matchMedia(this.mobileMediaQueryString);\n this.mobileMediaQuery.addEventListener('change', this.handleMediaQueryChange.bind(this));\n this.mobileScreenView = this.mobileMediaQuery.matches;\n }\n }\n\n disconnectedCallback() {\n this.mobileMediaQuery.removeEventListener('change', this.handleMediaQueryChange.bind(this));\n }\n\n private async decodeCertificate(certificate: CertificateProp) {\n this.isDecodeInProcess = true;\n\n try {\n if (certificate instanceof X509Certificate) {\n this.certificateDecoded = certificate;\n } else if (typeof certificate === 'string') {\n this.certificateDecoded = new X509Certificate(certificate);\n } else {\n return;\n }\n\n this.certificateDecoded.parseExtensions();\n await this.certificateDecoded.getThumbprint('SHA-1');\n await this.certificateDecoded.getThumbprint('SHA-256');\n } catch (error) {\n this.certificateDecodeError = error;\n\n console.error('Error certificate parse:', error);\n }\n\n this.isDecodeInProcess = false;\n }\n\n /**\n * Rerun decodeCertificate if previuos value not equal current value\n */\n @Watch('certificate')\n watchCertificateAndDecode(newValue: CertificateProp, oldValue: CertificateProp) {\n if (typeof newValue === 'string' && typeof oldValue === 'string') {\n if (newValue !== oldValue) {\n this.decodeCertificate(newValue);\n }\n\n return;\n }\n\n if (newValue instanceof X509Certificate && oldValue instanceof X509Certificate) {\n if (newValue.serialNumber !== oldValue.serialNumber) {\n this.decodeCertificate(newValue);\n }\n }\n }\n\n private getAuthKeyIdParentLink = (value: string) => this.authKeyIdParentLink\n ?.replace('{{authKeyId}}', value);\n\n private getAuthKeyIdSiblingsLink = (value: string) => this.authKeyIdSiblingsLink\n ?.replace('{{authKeyId}}', value);\n\n private getSubjectKeyIdChildrenLink = (value: string) => this.subjectKeyIdChildrenLink\n ?.replace('{{subjectKeyId}}', value);\n\n private getSubjectKeyIdSiblingsLink = (value: string) => this.subjectKeyIdSiblingsLink\n ?.replace('{{subjectKeyId}}', value);\n\n private getIssuerDnLink() {\n return this.issuerDnLink;\n }\n\n // eslint-disable-next-line class-methods-use-this\n private renderErrorState() {\n return (\n <div class=\"status_wrapper\">\n <Typography>\n There was an error decoding this certificate.\n </Typography>\n </div>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n private renderEmptyState() {\n return (\n <div class=\"status_wrapper\">\n <Typography>\n There is no certificate available.\n </Typography>\n </div>\n );\n }\n\n render() {\n if (this.certificateDecodeError) {\n return this.renderErrorState();\n }\n\n if (!this.certificateDecoded) {\n return this.renderEmptyState();\n }\n\n return (\n <Host\n data-mobile-screen-view={String(this.mobileScreenView)}\n >\n <table>\n <BasicInformation\n {...this.certificateDecoded}\n />\n\n <SubjectName\n name={this.certificateDecoded.subject}\n />\n\n <IssuerName\n name={this.certificateDecoded.issuer}\n issuerDnLink={this.getIssuerDnLink()}\n />\n\n <PublicKey\n publicKey={this.certificateDecoded.publicKey}\n />\n\n <Signature\n signature={this.certificateDecoded.signature}\n />\n\n <Thumbprints\n thumbprints={this.certificateDecoded.thumbprints}\n />\n\n <Extensions\n extensions={this.certificateDecoded.extensions}\n getLEILink={getLEILink}\n getDNSNameLink={getDNSNameLink}\n getIPAddressLink={getIPAddressLink}\n getAuthKeyIdParentLink={this.getAuthKeyIdParentLink}\n getAuthKeyIdSiblingsLink={this.getAuthKeyIdSiblingsLink}\n getSubjectKeyIdChildrenLink={this.getSubjectKeyIdChildrenLink}\n getSubjectKeyIdSiblingsLink={this.getSubjectKeyIdSiblingsLink}\n />\n\n {this.download && (\n <Miscellaneous\n certificate={this.certificateDecoded}\n />\n )}\n </table>\n </Host>\n );\n }\n}\n"],"mappings":";;;0iBAAA,IAAMA,qBAAuB,mhSAC7B,IAAAC,gCAAeD,qB,ICwCFE,kBAAiB,W,kDAsIpBC,KAAAC,uBAAyB,SAACC,G,MAAkB,OAAAC,EAAAC,EAAKC,uBAAmB,MAAAF,SAAA,SAAAA,EACxEG,QAAQ,gBAAiBJ,E,EAErBF,KAAAO,yBAA2B,SAACL,G,MAAkB,OAAAC,EAAAC,EAAKI,yBAAqB,MAAAL,SAAA,SAAAA,EAC5EG,QAAQ,gBAAiBJ,E,EAErBF,KAAAS,4BAA8B,SAACP,G,MAAkB,OAAAC,EAAAC,EAAKM,4BAAwB,MAAAP,SAAA,SAAAA,EAClFG,QAAQ,mBAAoBJ,E,EAExBF,KAAAW,4BAA8B,SAACT,G,MAAkB,OAAAC,EAAAC,EAAKQ,4BAAwB,MAAAT,SAAA,SAAAA,EAClFG,QAAQ,mBAAoBJ,E,qQA9E4B,qB,sBAEvB,M,uBAEC,I,CAE9BW,EAAAC,UAAAC,uBAAA,SAAuBC,GAC7BhB,KAAKiB,iBAAmBD,EAAME,O,EAGhCL,EAAAC,UAAAK,kBAAA,WACEnB,KAAKoB,kBAAkBpB,KAAKqB,aAEP,CACnBrB,KAAKsB,iBAAmBC,OAAOC,WAAWxB,KAAKyB,wBAC/CzB,KAAKsB,iBAAiBI,iBAAiB,SAAU1B,KAAKe,uBAAuBY,KAAK3B,OAClFA,KAAKiB,iBAAmBjB,KAAKsB,iBAAiBJ,O,GAIlDL,EAAAC,UAAAc,qBAAA,WACE5B,KAAKsB,iBAAiBO,oBAAoB,SAAU7B,KAAKe,uBAAuBY,KAAK3B,M,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,YAAW,CACVC,KAAM3D,KAAKgC,mBAAmB4B,UAGhCZ,EAACa,WAAU,CACTF,KAAM3D,KAAKgC,mBAAmB8B,OAC9BhB,aAAc9C,KAAK6C,oBAGrBG,EAACe,UAAS,CACRC,UAAWhE,KAAKgC,mBAAmBgC,YAGrChB,EAACiB,UAAS,CACRC,UAAWlE,KAAKgC,mBAAmBkC,YAGrClB,EAACmB,YAAW,CACVC,YAAapE,KAAKgC,mBAAmBoC,cAGvCpB,EAACqB,WAAU,CACTC,WAAYtE,KAAKgC,mBAAmBsC,WACpCC,WAAYA,WACZC,eAAgBA,eAChBC,iBAAkBA,iBAClBxE,uBAAwBD,KAAKC,uBAC7BM,yBAA0BP,KAAKO,yBAC/BE,4BAA6BT,KAAKS,4BAClCE,4BAA6BX,KAAKW,8BAGnCX,KAAK0E,UACJ1B,EAAC2B,cAAa,CACZtD,YAAarB,KAAKgC,sB,sJAhOF,G"}
1
+ {"version":3,"names":["certificateViewerCss","PeculiarCertificateViewerStyle0","CertificateViewer","this","getAuthKeyIdParentLink","value","_a","_this","authKeyIdParentLink","replace","getAuthKeyIdSiblingsLink","authKeyIdSiblingsLink","getSubjectKeyIdChildrenLink","subjectKeyIdChildrenLink","getSubjectKeyIdSiblingsLink","subjectKeyIdSiblingsLink","class_1","prototype","handleMediaQueryChange","event","mobileScreenView","matches","componentWillLoad","decodeCertificate","certificate","mobileMediaQuery","window","matchMedia","mobileMediaQueryString","addEventListener","bind","disconnectedCallback","removeEventListener","isDecodeInProcess","X509Certificate","certificateDecoded","parseExtensions","getThumbprint","_b","sent","certificateDecodeError","error_1","console","error","watchCertificateAndDecode","newValue","oldValue","serialNumber","getIssuerDnLink","issuerDnLink","renderErrorState","h","class","Typography","renderEmptyState","render","Host","String","BasicInformation","Object","assign","SubjectName","name","subject","IssuerName","issuer","PublicKey","publicKey","Signature","signature","Thumbprints","thumbprints","Extensions","extensions","getLEILink","getDNSNameLink","getIPAddressLink","download","Miscellaneous"],"sources":["src/components/certificate-viewer/certificate-viewer.scss?tag=peculiar-certificate-viewer&encapsulation=shadow","src/components/certificate-viewer/certificate-viewer.tsx"],"sourcesContent":["@import '../../css/base.scss';\n\n:host {\n display: block;\n width: 100%;\n position: relative;\n min-width: 280px;\n min-height: 300px;\n word-wrap: break-word;\n word-break: break-word;\n}\n\nth, td {\n border: none;\n}\n\ntable {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n\n td {\n padding: var(--pv-size-base-2) var(--pv-size-base-4);\n vertical-align: top;\n\n &:first-child {\n width: 220px;\n }\n\n &:last-child {\n width: calc(100% - 220px)\n }\n\n &.monospace {\n max-width: 0;\n }\n\n &.divider {\n padding: var(--pv-size-base-2) 0;\n\n span {\n height: 1px;\n display: block;\n background-color: var(--pv-color-gray-4);\n }\n }\n }\n\n .title td {\n padding-top: var(--pv-size-base-6);\n padding-bottom: var(--pv-size-base-2);\n }\n\n table {\n border-left: 1px solid var(--pv-color-gray-5);\n }\n}\n\n.status_wrapper {\n min-height: inherit;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n:host([data-mobile-screen-view=\"true\"]) {\n table, tr, td {\n display: block;\n }\n\n table {\n tr {\n padding: var(--pv-size-base-2) 0;\n\n &.title {\n padding-top: var(--pv-size-base-6);\n\n td {\n padding: 0 var(--pv-size-base-4);\n }\n }\n }\n\n td {\n padding: 0 var(--pv-size-base-4);\n width: 100% !important;\n max-width: 100% !important;\n\n &.divider {\n padding: 0;\n }\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 {\n Component,\n h,\n Prop,\n State,\n Watch,\n Host,\n Build,\n} from '@stencil/core';\n\nimport {\n X509Certificate,\n} from '../../crypto';\nimport { getDNSNameLink, getIPAddressLink, getLEILink } from '../../utils/third_party_links';\nimport {\n BasicInformation,\n SubjectName,\n IssuerName,\n PublicKey,\n Signature,\n Thumbprints,\n Extensions,\n Miscellaneous,\n} from '../certificate-details-parts';\nimport { Typography } from '../typography';\n\nexport type CertificateProp = string | X509Certificate;\n\n@Component({\n tag: 'peculiar-certificate-viewer',\n styleUrl: 'certificate-viewer.scss',\n shadow: true,\n})\nexport class CertificateViewer {\n private certificateDecoded: X509Certificate;\n\n private certificateDecodeError: Error;\n\n private mobileMediaQuery: MediaQueryList;\n\n /**\n * The certificate value for decode and show details. Use PEM or DER.\n */\n @Prop({ reflect: true }) certificate: CertificateProp;\n\n /**\n * If `true` - component will show split-button to download certificate as PEM or DER.\n */\n @Prop({ reflect: true }) download?: boolean;\n\n /**\n * Authority Key Identifier extension parent link.\n * <br />\n * **NOTE**: `{{authKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.subject_key_id:%20{{authKeyId}}\n */\n @Prop({ reflect: true }) authKeyIdParentLink?: string;\n\n /**\n * Authority Key Identifier extension siblings link.\n * <br />\n * **NOTE**: `{{authKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.authority_key_id:%20{{authKeyId}}\n */\n @Prop({ reflect: true }) authKeyIdSiblingsLink?: string;\n\n /**\n * Subject Key Identifier extension children link.\n * <br />\n * **NOTE**: `{{subjectKeyId}}` will be replaced to value from the extension.\n * @example\n * https://censys.io/certificates?q=parsed.extensions.authority_key_id:%20{{subjectKeyId}}\n */\n @Prop({ reflect: true }) subjectKeyIdChildrenLink?: string;\n\n /**\n * Subject Key Identifier extension siblings link.\n * <br />\n * **NOTE**: `{{subjectKeyId}}` will be replaced to value from the extension.\n * @example\n * https://some.com/{{subjectKeyId}}\n */\n @Prop({ reflect: true }) subjectKeyIdSiblingsLink?: string;\n\n /**\n * Issuer DN link.\n * **NOTE**: HTML component attribute must be `issuer-dn-link`.\n */\n @Prop({ reflect: true }) issuerDnLink?: string;\n\n /**\n * Mobile media query string to control screen view change.\n * <br />\n * **NOTE**: Based on https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia.\n * @example\n * (max-width: 900px)\n */\n @Prop({ reflect: false }) mobileMediaQueryString?: string = '(max-width: 900px)';\n\n @State() mobileScreenView: boolean = false;\n\n @State() isDecodeInProcess: boolean = true;\n\n private handleMediaQueryChange(event: MediaQueryListEvent) {\n this.mobileScreenView = event.matches;\n }\n\n componentWillLoad() {\n this.decodeCertificate(this.certificate);\n\n if (Build.isBrowser) {\n this.mobileMediaQuery = window.matchMedia(this.mobileMediaQueryString);\n this.mobileMediaQuery.addEventListener('change', this.handleMediaQueryChange.bind(this));\n this.mobileScreenView = this.mobileMediaQuery.matches;\n }\n }\n\n disconnectedCallback() {\n this.mobileMediaQuery.removeEventListener('change', this.handleMediaQueryChange.bind(this));\n }\n\n private async decodeCertificate(certificate: CertificateProp) {\n this.isDecodeInProcess = true;\n\n try {\n if (certificate instanceof X509Certificate) {\n this.certificateDecoded = certificate;\n } else if (typeof certificate === 'string') {\n this.certificateDecoded = new X509Certificate(certificate);\n } else {\n return;\n }\n\n this.certificateDecoded.parseExtensions();\n await this.certificateDecoded.getThumbprint('SHA-1');\n await this.certificateDecoded.getThumbprint('SHA-256');\n } catch (error) {\n this.certificateDecodeError = error;\n\n console.error('Error certificate parse:', error);\n }\n\n this.isDecodeInProcess = false;\n }\n\n /**\n * Rerun decodeCertificate if previuos value not equal current value\n */\n @Watch('certificate')\n watchCertificateAndDecode(newValue: CertificateProp, oldValue: CertificateProp) {\n if (typeof newValue === 'string' && typeof oldValue === 'string') {\n if (newValue !== oldValue) {\n this.decodeCertificate(newValue);\n }\n\n return;\n }\n\n if (newValue instanceof X509Certificate && oldValue instanceof X509Certificate) {\n if (newValue.serialNumber !== oldValue.serialNumber) {\n this.decodeCertificate(newValue);\n }\n }\n }\n\n private getAuthKeyIdParentLink = (value: string) => this.authKeyIdParentLink\n ?.replace('{{authKeyId}}', value);\n\n private getAuthKeyIdSiblingsLink = (value: string) => this.authKeyIdSiblingsLink\n ?.replace('{{authKeyId}}', value);\n\n private getSubjectKeyIdChildrenLink = (value: string) => this.subjectKeyIdChildrenLink\n ?.replace('{{subjectKeyId}}', value);\n\n private getSubjectKeyIdSiblingsLink = (value: string) => this.subjectKeyIdSiblingsLink\n ?.replace('{{subjectKeyId}}', value);\n\n private getIssuerDnLink() {\n return this.issuerDnLink;\n }\n\n // eslint-disable-next-line class-methods-use-this\n private renderErrorState() {\n return (\n <div class=\"status_wrapper\">\n <Typography>\n There was an error decoding this certificate.\n </Typography>\n </div>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n private renderEmptyState() {\n return (\n <div class=\"status_wrapper\">\n <Typography>\n There is no certificate available.\n </Typography>\n </div>\n );\n }\n\n render() {\n if (this.certificateDecodeError) {\n return this.renderErrorState();\n }\n\n if (!this.certificateDecoded) {\n return this.renderEmptyState();\n }\n\n return (\n <Host\n data-mobile-screen-view={String(this.mobileScreenView)}\n >\n <table>\n <BasicInformation\n {...this.certificateDecoded}\n />\n\n <SubjectName\n name={this.certificateDecoded.subject}\n />\n\n <IssuerName\n name={this.certificateDecoded.issuer}\n issuerDnLink={this.getIssuerDnLink()}\n />\n\n <PublicKey\n publicKey={this.certificateDecoded.publicKey}\n />\n\n <Signature\n signature={this.certificateDecoded.signature}\n />\n\n <Thumbprints\n thumbprints={this.certificateDecoded.thumbprints}\n />\n\n <Extensions\n extensions={this.certificateDecoded.extensions}\n getLEILink={getLEILink}\n getDNSNameLink={getDNSNameLink}\n getIPAddressLink={getIPAddressLink}\n getAuthKeyIdParentLink={this.getAuthKeyIdParentLink}\n getAuthKeyIdSiblingsLink={this.getAuthKeyIdSiblingsLink}\n getSubjectKeyIdChildrenLink={this.getSubjectKeyIdChildrenLink}\n getSubjectKeyIdSiblingsLink={this.getSubjectKeyIdSiblingsLink}\n />\n\n {this.download && (\n <Miscellaneous\n certificate={this.certificateDecoded}\n />\n )}\n </table>\n </Host>\n );\n }\n}\n"],"mappings":";;;2gBAAA,IAAMA,qBAAuB,mhSAC7B,IAAAC,gCAAeD,qB,ICwCFE,kBAA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WAAU,CACTC,WAAYtE,KAAKgC,mBAAmBsC,WACpCC,WAAYA,WACZC,eAAgBA,eAChBC,iBAAkBA,iBAClBxE,uBAAwBD,KAAKC,uBAC7BM,yBAA0BP,KAAKO,yBAC/BE,4BAA6BT,KAAKS,4BAClCE,4BAA6BX,KAAKW,8BAGnCX,KAAK0E,UACJ1B,EAAC2B,cAAa,CACZtD,YAAarB,KAAKgC,sB,sJAhOF,G"}
@@ -1,7 +1,7 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,e,r,a){function o(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,i){function n(t){try{c(a.next(t))}catch(t){i(t)}}function s(t){try{c(a["throw"](t))}catch(t){i(t)}}function c(t){t.done?r(t.value):o(t.value).then(n,s)}c((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,o,i,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(t){return function(e){return c([t,e])}}function c(s){if(a)throw new TypeError("Generator is already executing.");while(n&&(n=0,s[0]&&(r=0)),r)try{if(a=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t];o=0}finally{a=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var a=0,o=e.length,i;a<o;a++){if(i||!(a in e)){if(!i)i=Array.prototype.slice.call(e,0,a);i[a]=e[a]}}return t.concat(i||Array.prototype.slice.call(e))};
2
2
  /*!
3
3
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
4
- */import{h,r as registerInstance,c as createEvent,H as Host}from"./index-ae188432.js";import{X as X509Certificate}from"./x509_certificate-ad568d3a.js";import{$ as l10n,a0 as dateShort,a1 as OIDs}from"./certification_request-2c054ece.js";import"./download-8c128e2e.js";import{T as Typography,B as Button}from"./button-a2fabf9a.js";import{D as DetailsIcon,L as LinkIcon,C as CrossIcon}from"./cross-1377606f.js";import{D as DownloadIcon}from"./download-14dc1047.js";import{a as ArrowTopIcon,A as ArrowBottomIcon}from"./arrow_top-aee1ee02.js";
4
+ */import{h,r as registerInstance,c as createEvent,H as Host}from"./index-ae188432.js";import{X as X509Certificate}from"./x509_certificate-050175dd.js";import{Z as l10n,_ as dateShort,$ as OIDs}from"./certification_request-b531916a.js";import{T as Typography,B as Button}from"./button-a2fabf9a.js";import{D as DetailsIcon,L as LinkIcon,C as CrossIcon}from"./cross-1377606f.js";import{D as DownloadIcon}from"./download-14dc1047.js";import{a as ArrowTopIcon,A as ArrowBottomIcon}from"./arrow_top-aee1ee02.js";
5
5
  /**
6
6
  * @license
7
7
  * Copyright (c) Peculiar Ventures, LLC.
@@ -0,0 +1,19 @@
1
+ var __extends=this&&this.__extends||function(){var e=function(t,n){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]};return e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function a(){this.constructor=t}t.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();var __awaiter=this&&this.__awaiter||function(e,t,n,a){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function s(e){try{u(a.next(e))}catch(e){r(e)}}function o(e){try{u(a["throw"](e))}catch(e){r(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,o)}u((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},a,i,r,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(e){return function(t){return u([e,t])}}function u(o){if(a)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(n=0)),n)try{if(a=1,i&&(r=o[0]&2?i["return"]:o[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;if(i=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;i=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){n.label=o[1];break}if(o[0]===6&&n.label<r[1]){n.label=r[1];r=o;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(o);break}if(r[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];i=0}finally{a=r=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var _a;
2
+ /*!
3
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
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";
5
+ /**
6
+ * @license
7
+ * Copyright (c) Peculiar Ventures, LLC.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */var attributesParsers=(_a={},_a[id_DomainNameBeneficiary]=DomainNameBeneficiary,_a[id_DomainNameLegalRepresentative]=DomainNameLegalRepresentative,_a[id_DomainNameOwner]=DomainNameOwner,_a[id_DomainNameTechnicalOperator]=DomainNameTechnicalOperator,_a[id_TypeRelationship]=TypeRelationship,_a[id_ActivityDescription]=ActivityDescription,_a[id_WebGDPR]=WebGDPR,_a[id_InsuranceValue]=InsuranceValue,_a[id_ValuationRanking]=ValuationRanking,_a[id_pkcs9_at_challengePassword]=ChallengePassword,_a[id_pkcs9_at_unstructuredName]=UnstructuredName,_a[id_pkcs9_at_extensionRequest]=ExtensionRequest,_a);var Attribute=function(e){__extends(t,e);function t(t){var n=e.call(this,t,Attribute$1)||this;var a=n.getAsnExtnValue();try{var i=attributesParsers[n.asn.type];if(i){n.value=AsnParser.parse(a,i)}else{console.warn("Didn't detect parser for \"".concat(n.asn.type,'" attribute.'));n.value=Convert_1.ToHex(a)}}catch(e){console.error('Error parse "'.concat(n.asn.type,'" attribute:'),e.message);n.value=Convert_1.ToHex(a)}return n}t.prototype.getAsnExtnValue=function(){return this.asn.values[0]};return t}(AsnData);
12
+ /**
13
+ * @license
14
+ * Copyright (c) Peculiar Ventures, LLC.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Pkcs10CertificateRequest=function(e){__extends(t,e);function t(t){var n=e.call(this,certificateRawToBuffer(t),CertificationRequest)||this;n.thumbprints={};n.type="PKCS#10 Certificate Request";n.tag="CERTIFICATE REQUEST";var a=n.asn.certificationRequestInfo;n.subject=new Name(a.subject).toJSON();n.version=a.version;return n}Object.defineProperty(t.prototype,"publicKey",{get:function(){var e=this.asn.certificationRequestInfo.subjectPKInfo,t=e.subjectPublicKey,n=e.algorithm;var a;if(n.algorithm===id_ecPublicKey&&n.parameters){a=AsnConvert.parse(n.parameters,ECParameters)}if(n.algorithm===id_rsaEncryption){a=AsnConvert.parse(t,RSAPublicKey)}var i=AsnConvert.serialize(this.asn.certificationRequestInfo.subjectPKInfo);return{params:a,value:i,algorithm:n.algorithm}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"signature",{get:function(){var e=this.asn,t=e.signature,n=e.signatureAlgorithm;return{value:t,algorithm:n.algorithm}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"commonName",{get:function(){if(!this.subject){return""}for(var e=0;e<this.subject.length;e+=1){var t=this.subject[e];if(t.shortName==="CN"||t.shortName==="E"||t.shortName==="O"){return t.value}}return""},enumerable:false,configurable:true});t.prototype.getThumbprint=function(){return __awaiter(this,arguments,void 0,(function(e){var t,n;if(e===void 0){e="SHA-1"}return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,getCertificateThumbprint(e,this.raw)];case 1:t=a.sent();if(t){this.thumbprints[e]=Convert_1.ToHex(t)}return[3,3];case 2:n=a.sent();console.error("Error thumbprint get:",n);return[3,3];case 3:return[2]}}))}))};t.prototype.parseAttributes=function(){var e=this.asn.certificationRequestInfo;if(e.attributes){this.attributes=e.attributes.map((function(e){return new Attribute(AsnConvert.serialize(e))}));var t=this.attributes.find((function(e){return e.asn.type===id_pkcs9_at_extensionRequest}));if(t){this.extensions=t.value.map((function(e){return new Extension(AsnConvert.serialize(e))}))}}};t.prototype.toString=function(e){if(e===void 0){e="pem"}switch(e){case"hex":return hexFormat(Convert_1.ToHex(this.raw));case"pem":return"-----BEGIN ".concat(this.tag,"-----\n").concat(base64Format(this.toString("base64")),"\n-----END ").concat(this.tag,"-----");default:return Convert_1.ToBase64(this.raw)}};t.prototype.downloadAsPEM=function(e){Download.csr.asPEM(this.toString("pem"),e||this.commonName)};t.prototype.downloadAsDER=function(e){Download.csr.asDER(this.raw,e||this.commonName)};return t}(AsnData);export{Attribute as A,Pkcs10CertificateRequest as P};
19
+ //# sourceMappingURL=pkcs10_certificate_request-cca2ca68.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["attributesParsers","_a","id_DomainNameBeneficiary","DomainNameBeneficiary","id_DomainNameLegalRepresentative","DomainNameLegalRepresentative","id_DomainNameOwner","DomainNameOwner","id_DomainNameTechnicalOperator","DomainNameTechnicalOperator","id_TypeRelationship","TypeRelationship","id_ActivityDescription","ActivityDescription","id_WebGDPR","WebGDPR","id_InsuranceValue","InsuranceValue","id_ValuationRanking","ValuationRanking","id_pkcs9_at_challengePassword","ChallengePassword","id_pkcs9_at_unstructuredName","UnstructuredName","id_pkcs9_at_extensionRequest","ExtensionRequest","__extends","Attribute","_super","raw","_this","call","this","AsnAttribute","asnExtnValue","getAsnExtnValue","target","asn","type","value","AsnParser","parse","console","warn","concat","Convert","ToHex","error","message","prototype","values","AsnData","Pkcs10CertificateRequest","certificateRawToBuffer","CertificationRequest","thumbprints","tag","certificationRequestInfo","subject","Name","toJSON","version","Object","defineProperty","subjectPKInfo","subjectPublicKey","algorithm","params","id_ecPublicKey","parameters","AsnConvert","ECParameters","id_rsaEncryption","RSAPublicKey","spki","serialize","signature","signatureAlgorithm","i","length","name","shortName","getThumbprint","getCertificateThumbprint","thumbprint","sent","error_1","parseAttributes","attributes","map","e","extensionRequestAttribute","find","attribute","extensions","Extension","toString","format","hexFormat","base64Format","ToBase64","downloadAsPEM","Download","csr","asPEM","commonName","downloadAsDER","asDER"],"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"],"mappings":";;;;;;;;;;GAoDA,IAAMA,mBAAiBC,GAAA,GACrBA,GAACC,0BAA2BC,sBAC5BF,GAACG,kCAAmCC,8BACpCJ,GAACK,oBAAqBC,gBACtBN,GAACO,gCAAiCC,4BAClCR,GAACS,qBAAsBC,iBACvBV,GAACW,wBAAyBC,oBAC1BZ,GAACa,YAAaC,QACdd,GAACe,mBAAoBC,eACrBhB,GAACiB,qBAAsBC,iBACvBlB,GAACmB,+BAAgCC,kBACjCpB,GAACqB,8BAA+BC,iBAChCtB,GAACuB,8BAA+BC,iB,8BAMwBC,UAAAC,EAAAC,GAOxD,SAAAD,EAAYE,GACV,IAAAC,EAAAF,EAAKG,KAAAC,KAACH,EAAKI,cAAaD,KAExB,IAAME,EAAeJ,EAAKK,kBAE1B,IACE,IAAMC,EAASpC,kBAAkB8B,EAAKO,IAAIC,MAE1C,GAAIF,EAAQ,CACVN,EAAKS,MAAQC,UAAUC,MAASP,EAAcE,E,KACzC,CACLM,QAAQC,KAAK,8BAAAC,OAA6Bd,EAAKO,IAAIC,KAAI,iBAEvDR,EAAKS,MAAQM,UAAQC,MAAMZ,E,E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B,IAAG,SACpG,QACE,OAAOX,UAAQuD,SAASpE,KAAKH,K,EAI5BuB,EAAAH,UAAAoD,cAAA,SAAcrB,GACnBsB,SAASC,IAAIC,MACXxE,KAAKgE,SAAS,OACdhB,GAAQhD,KAAKyE,W,EAIVrD,EAAAH,UAAAyD,cAAA,SAAc1B,GACnBsB,SAASC,IAAII,MACX3E,KAAKH,IACLmD,GAAQhD,KAAKyE,W,YA3H2BtD,gB"}
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
+ */
4
+ /**
5
+ * @license
6
+ * Copyright (c) Peculiar Ventures, LLC.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ function readAsBinaryString(e){return new Promise((function(r,n){var i=new FileReader;i.onload=function(){return r({value:i.result,fileName:e.name,fileSize:e.size,sourceMime:e.type})};i.onerror=function(){return n(i.error)};i.readAsBinaryString(e)}))}function readAsArrayBuffer(e){return new Promise((function(r,n){var i=new FileReader;i.onload=function(){return r({value:i.result,fileName:e.name,fileSize:e.size,sourceMime:e.type})};i.onerror=function(){return n(i.error)};i.readAsArrayBuffer(e)}))}function readAsDataUrl(e){return new Promise((function(r,n){var i=new FileReader;i.onload=function(){return r({value:i.result,fileName:e.name,fileSize:e.size,sourceMime:e.type})};i.onerror=function(){return n(i.error)};i.readAsDataURL(e)}))}function readAsText(e,r){return new Promise((function(n,i){var u=new FileReader;u.onload=function(){return n({value:u.result,fileName:e.name,fileSize:e.size,sourceMime:e.type})};u.onerror=function(){return i(u.error)};u.readAsText(e,r)}))}export{readAsBinaryString as a,readAsDataUrl as b,readAsText as c,readAsArrayBuffer as r};
12
+ //# sourceMappingURL=read_file-bb0b1450.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["readAsBinaryString","file","Promise","resolve","reject","reader","FileReader","onload","value","result","fileName","name","fileSize","size","sourceMime","type","onerror","error","readAsArrayBuffer","readAsDataUrl","readAsDataURL","readAsText","options"],"sources":["src/utils/read_file.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\nexport type FileValue = string | ArrayBuffer | null;\nexport interface IFileDataType extends Blob {\n name?: string;\n mimeType?: string;\n lastModified?: number;\n}\nexport interface IReadFileResult {\n value: FileValue;\n fileName: string | undefined;\n fileSize: number | undefined;\n sourceMime: string | undefined;\n}\n\n/**\n * Read file as Binary string\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsBinaryString(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsBinaryString(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsBinaryString(file);\n });\n}\n\n/**\n * Read file as ArrayBuffer\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsArrayBuffer(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsArrayBuffer(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsArrayBuffer(file);\n });\n}\n\n/**\n * Read file as Data URL\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsDataUrl(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsDataUrl(file: IFileDataType): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Read file as Text\n *\n * @example\n * ```js\n * const file = new File(['file'], 'file.pdf', { type: 'text/plain' });\n * readAsText(file)\n * .then(result => console.log('Readed success', result))\n * .catch(err => console.log('An error occured when reading file', err));\n * ```\n */\n\nexport function readAsText(file: IFileDataType, options?: string): Promise<IReadFileResult> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => resolve({\n value: reader.result,\n fileName: file.name,\n fileSize: file.size,\n sourceMime: file.type,\n });\n\n reader.onerror = () => reject(reader.error);\n\n reader.readAsText(file, options);\n });\n}\n"],"mappings":";;;;;;;;;;SAiCgBA,mBAAmBC,GACjC,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IAAMC,EAAS,IAAIC,WAEnBD,EAAOE,OAAS,WAAM,OAAAJ,EAAQ,CAC5BK,MAAOH,EAAOI,OACdC,SAAUT,EAAKU,KACfC,SAAUX,EAAKY,KACfC,WAAYb,EAAKc,MAJG,EAOtBV,EAAOW,QAAU,WAAM,OAAAZ,EAAOC,EAAOY,MAAd,EAEvBZ,EAAOL,mBAAmBC,E,GAE9B,C,SAcgBiB,kBAAkBjB,GAChC,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IAAMC,EAAS,IAAIC,WAEnBD,EAAOE,OAAS,WAAM,OAAAJ,EAAQ,CAC5BK,MAAOH,EAAOI,OACdC,SAAUT,EAAKU,KACfC,SAAUX,EAAKY,KACfC,WAAYb,EAAKc,MAJG,EAOtBV,EAAOW,QAAU,WAAM,OAAAZ,EAAOC,EAAOY,MAAd,EAEvBZ,EAAOa,kBAAkBjB,E,GAE7B,C,SAcgBkB,cAAclB,GAC5B,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IAAMC,EAAS,IAAIC,WAEnBD,EAAOE,OAAS,WAAM,OAAAJ,EAAQ,CAC5BK,MAAOH,EAAOI,OACdC,SAAUT,EAAKU,KACfC,SAAUX,EAAKY,KACfC,WAAYb,EAAKc,MAJG,EAOtBV,EAAOW,QAAU,WAAM,OAAAZ,EAAOC,EAAOY,MAAd,EAEvBZ,EAAOe,cAAcnB,E,GAEzB,C,SAcgBoB,WAAWpB,EAAqBqB,GAC9C,OAAO,IAAIpB,SAAQ,SAACC,EAASC,GAC3B,IAAMC,EAAS,IAAIC,WAEnBD,EAAOE,OAAS,WAAM,OAAAJ,EAAQ,CAC5BK,MAAOH,EAAOI,OACdC,SAAUT,EAAKU,KACfC,SAAUX,EAAKY,KACfC,WAAYb,EAAKc,MAJG,EAOtBV,EAAOW,QAAU,WAAM,OAAAZ,EAAOC,EAAOY,MAAd,EAEvBZ,EAAOgB,WAAWpB,EAAMqB,E,GAE5B,Q"}
@@ -0,0 +1,12 @@
1
+ var __extends=this&&this.__extends||function(){var t=function(e,r){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=e[r]};return t(e,r)};return function(e,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();var __awaiter=this&&this.__awaiter||function(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,a){function o(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n["throw"](t))}catch(t){a(t)}}function s(t){t.done?r(t.value):i(t.value).then(o,u)}s((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(e){return s([t,e])}}function s(u){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(r=0)),r)try{if(n=1,i&&(a=u[0]&2?i["return"]:u[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;if(i=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:r.label++;return{value:u[1],done:false};case 5:r.label++;i=u[1];u=[0];continue;case 7:u=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1];a=u;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(u);break}if(a[2])r.ops.pop();r.trys.pop();continue}u=e.call(t,r)}catch(t){u=[6,t];i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};
2
+ /*!
3
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
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";
5
+ /**
6
+ * @license
7
+ * Copyright (c) Peculiar Ventures, LLC.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */var X509Certificate=function(t){__extends(e,t);function e(e){var r=t.call(this,certificateRawToBuffer(e),Certificate)||this;r.thumbprints={};r.type="X.509 Certificate";r.tag="CERTIFICATE";var n=r.asn.tbsCertificate;r.serialNumber=Convert_1.ToHex(n.serialNumber);r.subject=new Name(n.subject).toJSON();r.issuer=new Name(n.issuer).toJSON();r.version=n.version+1;var i=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!i){throw new Error("Cannot get 'notBefore' value")}r.notBefore=i;var a=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!a){throw new Error("Cannot get 'notAfter' value")}r.notAfter=a;r.validity=dateDiff(r.notBefore,r.notAfter);return r}e.prototype.parseExtensions=function(){var t=this.asn.tbsCertificate;if(t.extensions){this.extensions=t.extensions.map((function(t){return new Extension(AsnConvert.serialize(t))}))}};e.prototype.getPublicKeyInfo=function(t){var e=this;var r=t.subjectPublicKey,n=t.algorithm;var i;if(n.algorithm===id_ecPublicKey&&n.parameters){i=AsnConvert.parse(n.parameters,ECParameters)}if(n.algorithm===id_rsaEncryption){i=AsnConvert.parse(r,RSAPublicKey)}if(n.algorithm===id_composite_key){i=AsnConvert.parse(r,CompositePublicKey);i=i.map((function(t){return e.getPublicKeyInfo(t)}))}var a=AsnConvert.serialize(t);return{params:i,value:a,algorithm:n.algorithm}};Object.defineProperty(e.prototype,"publicKey",{get:function(){return this.getPublicKeyInfo(this.asn.tbsCertificate.subjectPublicKeyInfo)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"signature",{get:function(){var t=this.asn,e=t.signatureValue,r=t.signatureAlgorithm;var n;if(r.algorithm===id_alg_composite){var i=AsnConvert.parse(e,CompositeSignatureValue);var a=AsnConvert.parse(r.parameters,CompositeParams);n=a.map((function(t,e){return Object.assign(Object.assign({},t),{value:i[e]})}))}return{params:n,value:e,algorithm:r.algorithm}},enumerable:false,configurable:true});e.prototype.getThumbprint=function(){return __awaiter(this,arguments,void 0,(function(t){var e,r;if(t===void 0){t="SHA-1"}return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,getCertificateThumbprint(t,this.raw)];case 1:e=n.sent();if(e){this.thumbprints[t]=Convert_1.ToHex(e)}return[3,3];case 2:r=n.sent();console.error("Error thumbprint get:",r);return[3,3];case 3:return[2]}}))}))};Object.defineProperty(e.prototype,"commonName",{get:function(){if(!this.subject){return""}for(var t=0;t<this.subject.length;t+=1){var e=this.subject[t];if(e.shortName==="CN"||e.shortName==="E"||e.shortName==="O"){return e.value}}return""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"issuerCommonName",{get:function(){if(!this.issuer){return""}for(var t=0;t<this.issuer.length;t+=1){var e=this.issuer[t];if(e.shortName==="CN"){return e.value}if(e.shortName==="E"){return e.value}}return""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isRoot",{get:function(){return JSON.stringify(this.issuer)===JSON.stringify(this.subject)},enumerable:false,configurable:true});e.prototype.subjectToString=function(){if(!this.subject){return""}return this.subject.map((function(t){return"".concat(t.shortName,"=").concat(t.value)})).join(", ")};e.prototype.issuerToString=function(){if(!this.issuer){return""}return this.issuer.map((function(t){return"".concat(t.shortName,"=").concat(t.value)})).join(", ")};e.prototype.toString=function(t){if(t===void 0){t="pem"}switch(t){case"hex":return hexFormat(Convert_1.ToHex(this.raw));case"pem":return"-----BEGIN ".concat(this.tag,"-----\n").concat(base64Format(this.toString("base64")),"\n-----END ").concat(this.tag,"-----");default:return Convert_1.ToBase64(this.raw)}};e.prototype.downloadAsPEM=function(t){Download.cert.asPEM(this.toString("pem"),t||this.commonName)};e.prototype.downloadAsDER=function(t){Download.cert.asDER(this.raw,t||this.commonName)};return e}(AsnData);export{X509Certificate as X};
12
+ //# sourceMappingURL=x509_certificate-050175dd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__extends","X509Certificate","_super","raw","_this","call","this","certificateRawToBuffer","Certificate","thumbprints","type","tag","tbsCertificate","asn","serialNumber","Convert","ToHex","subject","Name","toJSON","issuer","version","notBefore","validity","utcTime","generalTime","Error","notAfter","dateDiff","prototype","parseExtensions","extensions","map","e","Extension","AsnConvert","serialize","getPublicKeyInfo","publicKeyInfo","subjectPublicKey","algorithm","params","id_ecPublicKey","parameters","parse","ECParameters","id_rsaEncryption","RSAPublicKey","id_composite_key","CompositePublicKey","param","spki","value","Object","defineProperty","subjectPublicKeyInfo","_a","signatureValue","signatureAlgorithm","id_alg_composite","compositeSignatureValues_1","CompositeSignatureValue","compositeParams","CompositeParams","index","assign","getThumbprint","getCertificateThumbprint","thumbprint","sent","console","error","error_1","i","length","name","shortName","JSON","stringify","subjectToString","concat","join","issuerToString","toString","format","hexFormat","base64Format","ToBase64","downloadAsPEM","Download","cert","asPEM","commonName","downloadAsDER","asDER","AsnData"],"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"],"mappings":";;;;;;;;;;mCAgDqCA,UAAAC,EAAAC,GAuBnC,SAAAD,EAAYE,GACV,IAAAC,EAAAF,EAAKG,KAAAC,KAACC,uBAAuBJ,GAAMK,cAAYF,KAP1CF,EAAAK,YAAsC,GAE7BL,EAAAM,KAAO,oBAEPN,EAAAO,IAAM,cAKZ,IAAAC,EAAmBR,EAAKS,IAAGD,eAEnCR,EAAKU,aAAeC,UAAQC,MAAMJ,EAAeE,cACjDV,EAAKa,QAAU,IAAIC,KAAKN,EAAeK,SAASE,SAChDf,EAAKgB,OAAS,IAAIF,KAAKN,EAAeQ,QAAQD,SAC9Cf,EAAKiB,QAAUT,EAAeS,QAAU,EAExC,IAAMC,EAAYV,EAAeW,SAASD,UAAUE,SAC/CZ,EAAeW,SAASD,UAAUG,YAEvC,IAAKH,EAAW,CACd,MAAM,IAAII,MAAM,+B,CAGlBtB,EAAKkB,UAAYA,EAEjB,IAAMK,EAAWf,EAAeW,SAASI,SAASH,SAC7CZ,EAAeW,SAASI,SAASF,YAEtC,IAAKE,EAAU,CACb,MAAM,IAAID,MAAM,8B,CAGlBtB,EAAKuB,SAAWA,EAChBvB,EAAKmB,SAAWK,SAASxB,EAAKkB,UAAWlB,EAAKuB,U,SAGzC1B,EAAA4B,UAAAC,gBAAA,WACG,IAAAlB,EAAmBN,KAAKO,IAAGD,eAEnC,GAAIA,EAAemB,WAAY,CAC7BzB,KAAKyB,WAAanB,EAAemB,WAC9BC,KAAI,SAACC,GAAM,WAAIC,UAAUC,WAAWC,UAAUH,GAAnC,G,GAIVhC,EAAA4B,UAAAQ,iBAAA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,OAAOd,KAAKc,OACTY,KAAI,SAAC2C,GAAI,MACR,GAAAK,OAAGL,EAAKC,UAAS,KAAAI,OAAIL,EAAKvB,MADlB,IAGT6B,KAAK,K,EAGHhF,EAAA4B,UAAAsD,SAAA,SAASC,GAAA,GAAAA,SAAA,GAAAA,EAAA,KAAwC,CACtD,OAAQA,GACN,IAAK,MACH,OAAOC,UAAUtE,UAAQC,MAAMV,KAAKH,MACtC,IAAK,MACH,MAAO,cAAA6E,OAAc1E,KAAKK,IAAG,WAAAqE,OAAUM,aAAahF,KAAK6E,SAAS,WAAU,eAAAH,OAAc1E,KAAKK,IAAG,SACpG,QACE,OAAOI,UAAQwE,SAASjF,KAAKH,K,EAI5BF,EAAA4B,UAAA2D,cAAA,SAAcb,GACnBc,SAASC,KAAKC,MACZrF,KAAK6E,SAAS,OACdR,GAAQrE,KAAKsF,W,EAIV3F,EAAA4B,UAAAgE,cAAA,SAAclB,GACnBc,SAASC,KAAKI,MACZxF,KAAKH,IACLwE,GAAQrE,KAAKsF,W,YArNkBG,gB"}
@@ -0,0 +1,19 @@
1
+ var __extends=this&&this.__extends||function(){var t=function(e,n){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))t[n]=e[n]};return t(e,n)};return function(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,a){function o(t){try{s(r.next(t))}catch(t){a(t)}}function u(t){try{s(r["throw"](t))}catch(t){a(t)}}function s(t){t.done?n(t.value):i(t.value).then(o,u)}s((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(e){return s([t,e])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(n=0)),n)try{if(r=1,i&&(a=u[0]&2?i["return"]:u[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;if(i=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;i=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1];a=u;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(u);break}if(a[2])n.ops.pop();n.trys.pop();continue}u=e.call(t,n)}catch(t){u=[6,t];i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};
2
+ /*!
3
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
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";import{A as Attribute}from"./pkcs10_certificate_request-cca2ca68.js";
5
+ /**
6
+ * @license
7
+ * Copyright (c) Peculiar Ventures, LLC.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */var X509AttributeCertificate=function(t){__extends(e,t);function e(e){var n;var r=t.call(this,certificateRawToBuffer(e),AttributeCertificate)||this;r.thumbprints={};r.type="X.509 Attribute Certificate";r.tag="ATTRIBUTE CERTIFICATE";var i=r.asn.acinfo;r.serialNumber=Convert_1.ToHex(i.serialNumber);r.version=i.version;var a=i.attrCertValidityPeriod.notBeforeTime;if(!a){throw new Error("Cannot get 'notBefore' value")}r.notBefore=a;var o=i.attrCertValidityPeriod.notAfterTime;if(!o){throw new Error("Cannot get 'notAfter' value")}r.notAfter=o;r.validity=dateDiff(r.notBefore,r.notAfter);r.issuer=i.issuer.v1Form||((n=i.issuer.v2Form)===null||n===void 0?void 0:n.issuerName);r.holder=i.holder;return r}Object.defineProperty(e.prototype,"signature",{get:function(){var t=this.asn,e=t.signatureValue,n=t.signatureAlgorithm;return{value:e,algorithm:n.algorithm}},enumerable:false,configurable:true});e.prototype.parseExtensions=function(){var t=this.asn.acinfo;if(t.extensions){this.extensions=t.extensions.map((function(t){return new Extension(AsnConvert.serialize(t))}))}};e.prototype.parseAttributes=function(){var t=this.asn.acinfo;if(t.attributes){this.attributes=t.attributes.map((function(t){return new Attribute(AsnConvert.serialize(t))}))}};e.prototype.getThumbprint=function(){return __awaiter(this,arguments,void 0,(function(t){var e,n;if(t===void 0){t="SHA-1"}return __generator(this,(function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,getCertificateThumbprint(t,this.raw)];case 1:e=r.sent();if(e){this.thumbprints[t]=Convert_1.ToHex(e)}return[3,3];case 2:n=r.sent();console.error("Error thumbprint get:",n);return[3,3];case 3:return[2]}}))}))};Object.defineProperty(e.prototype,"commonName",{get:function(){return"attribute-certificate-".concat(this.thumbprints["SHA-1"])},enumerable:false,configurable:true});e.prototype.toString=function(t){if(t===void 0){t="pem"}switch(t){case"hex":return hexFormat(Convert_1.ToHex(this.raw));case"pem":return"-----BEGIN ".concat(this.tag,"-----\n").concat(base64Format(this.toString("base64")),"\n-----END ").concat(this.tag,"-----");default:return Convert_1.ToBase64(this.raw)}};e.prototype.downloadAsPEM=function(t){Download.attrCert.asPEM(this.toString("pem"),t||this.commonName)};e.prototype.downloadAsDER=function(t){Download.attrCert.asDER(this.raw,t||this.commonName)};return e}(AsnData);
12
+ /**
13
+ * @license
14
+ * Copyright (c) Peculiar Ventures, LLC.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var X509Crl=function(t){__extends(e,t);function e(e){var n=t.call(this,certificateRawToBuffer(e),CertificateList)||this;n.thumbprints={};n.type="X.509 Certificate Revocation List";n.tag="X509 CRL";var r=n.asn.tbsCertList;n.issuer=new Name(r.issuer).toJSON();n.version=r.version+1;n.lastUpdate=r.thisUpdate.getTime();n.nextUpdate=r.nextUpdate.getTime();n.revokedCertificates=(r.revokedCertificates||[]).map((function(t){var e;return{revocationDate:t.revocationDate,userCertificate:t.userCertificate,crlEntryExtensions:(e=t.crlEntryExtensions)===null||e===void 0?void 0:e.map((function(t){return new Extension(AsnConvert.serialize(t))}))}}));return n}e.prototype.getThumbprint=function(){return __awaiter(this,arguments,void 0,(function(t){var e,n;if(t===void 0){t="SHA-1"}return __generator(this,(function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,getCertificateThumbprint(t,this.raw)];case 1:e=r.sent();if(e){this.thumbprints[t]=Convert_1.ToHex(e)}return[3,3];case 2:n=r.sent();console.error("Error thumbprint get:",n);return[3,3];case 3:return[2]}}))}))};Object.defineProperty(e.prototype,"signature",{get:function(){var t=this.asn,e=t.signature,n=t.signatureAlgorithm;return{value:e,algorithm:n.algorithm}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"commonName",{get:function(){if(!this.issuer){return""}for(var t=0;t<this.issuer.length;t+=1){var e=this.issuer[t];if(e.shortName==="CN"||e.shortName==="E"||e.shortName==="O"){return e.value}}return""},enumerable:false,configurable:true});e.prototype.parseExtensions=function(){var t=this.asn.tbsCertList;if(t.crlExtensions){this.extensions=t.crlExtensions.map((function(t){return new Extension(AsnConvert.serialize(t))}))}};e.prototype.toString=function(t){if(t===void 0){t="pem"}switch(t){case"hex":return hexFormat(Convert_1.ToHex(this.raw));case"pem":return"-----BEGIN ".concat(this.tag,"-----\n").concat(base64Format(this.toString("base64")),"\n-----END ").concat(this.tag,"-----");default:return Convert_1.ToBase64(this.raw)}};e.prototype.downloadAsPEM=function(t){Download.crl.asPEM(this.toString("pem"),t||this.commonName)};e.prototype.downloadAsDER=function(t){Download.crl.asDER(this.raw,t||this.commonName)};return e}(AsnData);export{X509AttributeCertificate as X,X509Crl as a};
19
+ //# sourceMappingURL=x509_crl-c497f907.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__extends","X509AttributeCertificate","_super","raw","_this","call","this","certificateRawToBuffer","AttributeCertificate","thumbprints","type","tag","acinfo","asn","serialNumber","Convert","ToHex","version","notBefore","attrCertValidityPeriod","notBeforeTime","Error","notAfter","notAfterTime","validity","dateDiff","issuer","v1Form","_a","v2Form","issuerName","holder","Object","defineProperty","prototype","_b","signatureValue","signatureAlgorithm","value","algorithm","parseExtensions","extensions","map","e","Extension","AsnConvert","serialize","parseAttributes","attributes","Attribute","getThumbprint","getCertificateThumbprint","thumbprint","sent","console","error","error_1","concat","toString","format","hexFormat","base64Format","ToBase64","downloadAsPEM","name","Download","attrCert","asPEM","commonName","downloadAsDER","asDER","AsnData","X509Crl","CertificateList","tbsCertList","Name","toJSON","lastUpdate","thisUpdate","getTime","nextUpdate","revokedCertificates","revokedCertificate","revocationDate","userCertificate","crlEntryExtensions","error_2","signature","i","length","shortName","crlExtensions","crl"],"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"],"mappings":";;;;;;;;;;4CA8B8CA,UAAAC,EAAAC,GAyB5C,SAAAD,EAAYE,G,MACV,IAAAC,EAAAF,EAAKG,KAAAC,KAACC,uBAAuBJ,GAAMK,uBAAqBF,KAXnDF,EAAAK,YAAsC,GAM7BL,EAAAM,KAAO,8BAEPN,EAAAO,IAAM,wBAKZ,IAAAC,EAAWR,EAAKS,IAAGD,OAE3BR,EAAKU,aAAeC,UAAQC,MAAMJ,EAAOE,cACzCV,EAAKa,QAAUL,EAAOK,QAEtB,IAAMC,EAAYN,EAAOO,uBAAuBC,cAEhD,IAAKF,EAAW,CACd,MAAM,IAAIG,MAAM,+B,CAGlBjB,EAAKc,UAAYA,EAEjB,IAAMI,EAAWV,EAAOO,uBAAuBI,aAE/C,IAAKD,EAAU,CACb,MAAM,IAAID,MAAM,8B,CAGlBjB,EAAKkB,SAAWA,EAChBlB,EAAKoB,SAAWC,SAASrB,EAAKc,UAAWd,EAAKkB,UAC9ClB,EAAKsB,OAASd,EAAOc,OAAOC,UAAUC,EAAAhB,EAAOc,OAAOG,UAAM,MAAAD,SAAA,SAAAA,EAAEE,YAC5D1B,EAAK2B,OAASnB,EAAOmB,O,SAGvBC,OAAAC,eAAWhC,EAAAiC,UAAA,YAAS,C,IAApB,WACQ,IAAAC,EAAyC7B,KAAKO,IAA5CuB,EAAcD,EAAAC,eAAEC,EAAkBF,EAAAE,mBAE1C,MAAO,CACLC,MAAOF,EACPG,UAAWF,EAAmBE,U,uCAI3BtC,EAAAiC,UAAAM,gBAAA,WACG,IAAA5B,EAAWN,KAAKO,IAAGD,OAE3B,GAAIA,EAAO6B,WAAY,CACrBnC,KAAKmC,WAAa7B,EAAO6B,WACtBC,KAAI,SAACC,GAAM,WAAIC,UAAUC,WAAW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1B,EAAK0B,YAAc,KAAO1B,EAAK0B,YAAc,IAAK,CAC/E,OAAO1B,EAAK1B,K,EAIhB,MAAO,E,uCAGFkC,EAAAtC,UAAAM,gBAAA,WACG,IAAAkC,EAAgBpE,KAAKO,IAAG6D,YAEhC,GAAIA,EAAYiB,cAAe,CAC7BrF,KAAKmC,WAAaiC,EAAYiB,cAC3BjD,KAAI,SAACC,GAAM,WAAIC,UAAUC,WAAWC,UAAUH,GAAnC,G,GAIX6B,EAAAtC,UAAAwB,SAAA,SAASC,GAAA,GAAAA,SAAA,GAAAA,EAAA,KAAwC,CACtD,OAAQA,GACN,IAAK,MACH,OAAOC,UAAU7C,UAAQC,MAAMV,KAAKH,MACtC,IAAK,MACH,MAAO,cAAAsD,OAAcnD,KAAKK,IAAG,WAAA8C,OAAUI,aAAavD,KAAKoD,SAAS,WAAU,eAAAD,OAAcnD,KAAKK,IAAG,SACpG,QACE,OAAOI,UAAQ+C,SAASxD,KAAKH,K,EAI5BqE,EAAAtC,UAAA6B,cAAA,SAAcC,GACnBC,SAAS2B,IAAIzB,MACX7D,KAAKoD,SAAS,OACdM,GAAQ1D,KAAK8D,W,EAIVI,EAAAtC,UAAAmC,cAAA,SAAcL,GACnBC,SAAS2B,IAAItB,MACXhE,KAAKH,IACL6D,GAAQ1D,KAAK8D,W,YA3GUG,gB"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
3
  */
4
- export{D as Download,d as downloadFromBuffer}from"./p-1f766dd5.js";export{B as Button,T as Typography}from"./p-4bc5ddbe.js";export{L as Link}from"./p-e6a6e602.js";export{C as CrossIcon,D as DetailsIcon,L as LinkIcon}from"./p-99efefea.js";export{D as DownloadIcon}from"./p-ae91d778.js";export{A as ActionsIcon}from"./p-a9487007.js";export{A as ArrowBottomIcon,a as ArrowTopIcon}from"./p-27ca6743.js";import"./p-3cb79cd9.js";
4
+ export{D as Download,d as downloadFromBuffer}from"./p-666438a8.js";export{r as readAsArrayBuffer,a as readAsBinaryString,b as readAsDataUrl,c as readAsText}from"./p-25a532a3.js";export{P as Pkcs10CertificateRequest}from"./p-b6d5e413.js";export{B as Button,T as Typography}from"./p-4bc5ddbe.js";export{L as Link}from"./p-e6a6e602.js";export{C as CrossIcon,D as DetailsIcon,L as LinkIcon}from"./p-99efefea.js";export{D as DownloadIcon}from"./p-ae91d778.js";export{A as ActionsIcon}from"./p-a9487007.js";export{A as ArrowBottomIcon,a as ArrowTopIcon}from"./p-27ca6743.js";import"./p-3cb79cd9.js";
5
5
  //# sourceMappingURL=index.esm.js.map