@peculiar/certificates-viewer 3.1.0 → 3.2.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 (72) hide show
  1. package/dist/cjs/{certification_request-878e786a.js → certification_request-cde57123.js} +137 -266
  2. package/dist/cjs/csr-78378ed0.js +150 -0
  3. package/dist/cjs/download-6724f3a7.js +79 -0
  4. package/dist/cjs/{download-5e7d5455.js → index-ff818d4d.js} +0 -72
  5. package/dist/cjs/index.cjs.js +2 -1
  6. package/dist/cjs/l10n-a048a686.js +145 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/peculiar-attribute-certificate-viewer_2.cjs.entry.js +479 -0
  9. package/dist/cjs/peculiar-button_5.cjs.entry.js +148 -0
  10. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +173 -0
  11. package/dist/cjs/peculiar-certificate-summary_3.cjs.entry.js +1 -1
  12. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +124 -0
  13. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +6 -4
  14. package/dist/cjs/peculiar.cjs.js +1 -1
  15. package/dist/cjs/public_key-e56dbe52.js +1104 -0
  16. package/dist/cjs/x509_attribute_certificate-cc325b70.js +87 -0
  17. package/dist/cjs/x509_certificate-51a97033.js +139 -0
  18. package/dist/collection/components/certificate-decoder/certificate-decoder.js +54 -23
  19. package/dist/collection/utils/index.js +0 -1
  20. package/dist/collection/www-copy/index.js +80 -0
  21. package/dist/esm/{certification_request-3402a181.js → certification_request-c0674647.js} +76 -205
  22. package/dist/esm/csr-c1b6a176.js +147 -0
  23. package/dist/esm/download-735fb2eb.js +76 -0
  24. package/dist/esm/{download-cf68ac2c.js → index-0ba131b0.js} +1 -71
  25. package/dist/esm/index.js +2 -1
  26. package/dist/esm/l10n-ac28fa92.js +141 -0
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/peculiar-attribute-certificate-viewer_2.entry.js +474 -0
  29. package/dist/esm/peculiar-button_5.entry.js +140 -0
  30. package/dist/esm/peculiar-certificate-decoder.entry.js +169 -0
  31. package/dist/esm/peculiar-certificate-summary_3.entry.js +1 -1
  32. package/dist/esm/peculiar-certificate-viewer.entry.js +120 -0
  33. package/dist/esm/peculiar-certificates-viewer.entry.js +5 -3
  34. package/dist/esm/peculiar.js +1 -1
  35. package/dist/esm/public_key-43b2cbf0.js +1089 -0
  36. package/dist/esm/x509_attribute_certificate-a6d4aa15.js +85 -0
  37. package/dist/esm/x509_certificate-12f6d344.js +137 -0
  38. package/dist/peculiar/index.esm.js +1 -1
  39. package/dist/peculiar/p-006865d7.js +4 -0
  40. package/dist/peculiar/p-17c4da7b.js +11 -0
  41. package/dist/peculiar/p-1ebab45c.js +78 -0
  42. package/dist/peculiar/{p-b09a1f0b.entry.js → p-38635919.entry.js} +1 -1
  43. package/dist/peculiar/p-3f8d1008.entry.js +4 -0
  44. package/dist/peculiar/p-42da7f97.js +11 -0
  45. package/dist/peculiar/p-464e0943.js +87 -0
  46. package/dist/peculiar/p-4f4c1d30.js +12 -0
  47. package/dist/peculiar/p-530afe84.entry.js +11 -0
  48. package/dist/peculiar/p-6011646e.entry.js +11 -0
  49. package/dist/peculiar/p-6c510523.js +18 -0
  50. package/dist/peculiar/p-d7a13cb4.js +18 -0
  51. package/dist/peculiar/p-dafae164.entry.js +4 -0
  52. package/dist/peculiar/p-e77d0ccc.entry.js +18 -0
  53. package/dist/peculiar/peculiar.esm.js +1 -1
  54. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +13 -1
  55. package/dist/types/components.d.ts +20 -0
  56. package/dist/types/utils/index.d.ts +0 -1
  57. package/package.json +2 -3
  58. package/dist/cjs/l10n-d4a77087.js +0 -767
  59. package/dist/cjs/peculiar-attribute-certificate-viewer_9.cjs.entry.js +0 -2187
  60. package/dist/collection/utils/history.js +0 -19
  61. package/dist/collection/utils/parse_hash.js +0 -28
  62. package/dist/collection/utils/query_stringify.js +0 -21
  63. package/dist/esm/l10n-9ac63748.js +0 -762
  64. package/dist/esm/peculiar-attribute-certificate-viewer_9.entry.js +0 -2175
  65. package/dist/peculiar/p-08538084.entry.js +0 -113
  66. package/dist/peculiar/p-3fc37750.entry.js +0 -4
  67. package/dist/peculiar/p-8ad24aa3.js +0 -87
  68. package/dist/peculiar/p-99797a49.js +0 -34
  69. package/dist/peculiar/p-c774ec0b.js +0 -18
  70. package/dist/types/utils/history.d.ts +0 -9
  71. package/dist/types/utils/parse_hash.d.ts +0 -9
  72. package/dist/types/utils/query_stringify.d.ts +0 -8
@@ -0,0 +1,141 @@
1
+ /*!
2
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
+ */
4
+ import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-bfbd2ad8.js';
5
+
6
+ var dayjs_min = createCommonjsModule(function (module, exports) {
7
+ !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},v="en",D={};D[v]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return v;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(v=i),i||!r&&v},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var v=this.$locale().weekStart||0,D=(y<v?y+7:y)-v;return $(r?m-D:m+(6-D),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,v=O.m(this,M);return v=(l={},l[c]=v/12,l[f]=v,l[h]=v/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?v:O.a(v)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[v],w.Ls=D,w.p={},w}));
8
+ });
9
+
10
+ var relativeTime = createCommonjsModule(function (module, exports) {
11
+ !function(r,e){module.exports=e();}(commonjsGlobal,(function(){return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,!0):i.diff(e,y.d,!0));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return "function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,!0)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)};}}));
12
+ });
13
+
14
+ /**
15
+ * @license
16
+ * Copyright (c) Peculiar Ventures, LLC.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ dayjs_min.extend(relativeTime);
22
+ const dateShort = (date) => (new Date(date).toUTCString());
23
+ const dateDiff = (dateStart, dateEnd) => {
24
+ if (!dateStart || !dateEnd) {
25
+ return '';
26
+ }
27
+ const start = dayjs_min(dateStart);
28
+ const end = dayjs_min(dateEnd);
29
+ return start.to(end, true);
30
+ };
31
+
32
+ const basicInformation = "Basic Information";
33
+ const subjectName = "Subject Name";
34
+ const issuerName = "Issuer Name";
35
+ const publicKeyInfo = "Public Key Info";
36
+ const signature = "Signature";
37
+ const extensions = "Extensions";
38
+ const miscellaneous = "Miscellaneous";
39
+ const download = "Download";
40
+ const serialNumber = "Serial Number";
41
+ const version = "Version";
42
+ const validity = "Validity";
43
+ const issued = "Issued";
44
+ const expired = "Expired";
45
+ const algorithm = "Algorithm";
46
+ const namedCurve = "Named Curve";
47
+ const exponent = "Exponent";
48
+ const modulus = "Modulus";
49
+ const value = "Value";
50
+ const valid = "Valid";
51
+ const revoked = "Revoked";
52
+ const issuer = "Issuer";
53
+ const name = "Name";
54
+ const publicKey = "Public Key";
55
+ const fingerprint = "Fingerprint";
56
+ const fingerprints = "Fingerprints";
57
+ const actions = "Actions";
58
+ const details = "Details";
59
+ const testURLs = "Test URLs";
60
+ const certificateDetails = "Certificate Details";
61
+ const holder = "Holder";
62
+ const digestInfo = "Digest Info";
63
+ const type = "Type";
64
+ const en = {
65
+ basicInformation: basicInformation,
66
+ subjectName: subjectName,
67
+ issuerName: issuerName,
68
+ publicKeyInfo: publicKeyInfo,
69
+ signature: signature,
70
+ extensions: extensions,
71
+ miscellaneous: miscellaneous,
72
+ download: download,
73
+ "download.pem": "Download PEM",
74
+ "download.der": "Download DER",
75
+ serialNumber: serialNumber,
76
+ version: version,
77
+ validity: validity,
78
+ issued: issued,
79
+ expired: expired,
80
+ algorithm: algorithm,
81
+ namedCurve: namedCurve,
82
+ exponent: exponent,
83
+ modulus: modulus,
84
+ value: value,
85
+ valid: valid,
86
+ revoked: revoked,
87
+ issuer: issuer,
88
+ name: name,
89
+ publicKey: publicKey,
90
+ fingerprint: fingerprint,
91
+ fingerprints: fingerprints,
92
+ actions: actions,
93
+ details: details,
94
+ testURLs: testURLs,
95
+ certificateDetails: certificateDetails,
96
+ holder: holder,
97
+ digestInfo: digestInfo,
98
+ type: type
99
+ };
100
+
101
+ /**
102
+ * @license
103
+ * Copyright (c) Peculiar Ventures, LLC.
104
+ *
105
+ * This source code is licensed under the MIT license found in the
106
+ * LICENSE file in the root directory of this source tree.
107
+ */
108
+ const MESSAGES_ALL = {
109
+ en,
110
+ };
111
+ class Localization {
112
+ constructor() {
113
+ this.setLocale = (locale) => {
114
+ this.locale = locale && MESSAGES_ALL[locale] ? locale : 'en';
115
+ };
116
+ this.getLocale = () => this.locale;
117
+ const language = window.navigator.language.slice(0, 2).toLowerCase();
118
+ this.setLocale(language);
119
+ }
120
+ getString(id, replacer) {
121
+ const value = MESSAGES_ALL[this.locale][id];
122
+ if (!value) {
123
+ return '';
124
+ }
125
+ if (!replacer) {
126
+ return value;
127
+ }
128
+ const splitted = value.split(replacer.pattern);
129
+ if (splitted.length > 1) {
130
+ return [
131
+ splitted[0],
132
+ replacer.replacer,
133
+ splitted[1],
134
+ ];
135
+ }
136
+ return value;
137
+ }
138
+ }
139
+ const l10n = new Localization();
140
+
141
+ export { dateShort as a, dateDiff as d, l10n as l };
@@ -13,7 +13,7 @@ const patchEsm = () => {
13
13
  const defineCustomElements = (win, options) => {
14
14
  if (typeof window === 'undefined') return Promise.resolve();
15
15
  return patchEsm().then(() => {
16
- return bootstrapLazy([["peculiar-attribute-certificate-viewer_9",[[1,"peculiar-certificate-decoder",{"certificateExample":[1,"certificate-example"],"certificateDecoded":[32]}],[1,"peculiar-attribute-certificate-viewer",{"certificate":[1],"download":[4],"authKeyIdParentLink":[513,"auth-key-id-parent-link"],"authKeyIdSiblingsLink":[513,"auth-key-id-siblings-link"],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"isDecodeInProcess":[32]}],[1,"peculiar-csr-viewer",{"certificate":[513],"download":[4],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"view":[513],"isDecodeInProcess":[32]}],[1,"peculiar-certificate-viewer",{"certificate":[513],"download":[516],"authKeyIdParentLink":[513,"auth-key-id-parent-link"],"authKeyIdSiblingsLink":[513,"auth-key-id-siblings-link"],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"issuerDnLink":[513,"issuer-dn-link"],"view":[513],"isDecodeInProcess":[32]}],[1,"peculiar-button-split",{"onClick":[16],"fill":[1],"actions":[16],"open":[32]}],[1,"peculiar-text-hider",{"opened":[1540]},[[0,"textExpand","textExpandHandler"]]],[1,"peculiar-link",{"href":[513],"type":[513]}],[1,"peculiar-typography",{"type":[513],"color":[1],"align":[1],"ellipsis":[4],"monospace":[4]}],[1,"peculiar-button",{"fill":[1],"disabled":[516],"href":[1],"target":[1],"onClick":[16]}]]],["peculiar-certificate-summary_3",[[1,"peculiar-certificate-summary",{"certificate":[16],"showIssuer":[4,"show-issuer"]}],[1,"peculiar-circular-progress",{"size":[2],"width":[2]}],[1,"peculiar-highlight-words",{"search":[1]}]]],["peculiar-certificates-viewer",[[1,"peculiar-certificates-viewer",{"certificates":[16],"filterWithSearch":[4,"filter-with-search"],"highlightWithSearch":[4,"highlight-with-search"],"search":[32],"certificatesDecoded":[32],"expandedRow":[32],"certificateSelectedForDetails":[32],"isDecodeInProcess":[32]}]]]], options);
16
+ return bootstrapLazy([["peculiar-button_5",[[1,"peculiar-button-split",{"onClick":[16],"fill":[1],"actions":[16],"open":[32]}],[1,"peculiar-text-hider",{"opened":[1540]},[[0,"textExpand","textExpandHandler"]]],[1,"peculiar-link",{"href":[513],"type":[513]}],[1,"peculiar-typography",{"type":[513],"color":[1],"align":[1],"ellipsis":[4],"monospace":[4]}],[1,"peculiar-button",{"fill":[1],"disabled":[516],"href":[1],"target":[1],"onClick":[16]}]]],["peculiar-certificates-viewer",[[1,"peculiar-certificates-viewer",{"certificates":[16],"filterWithSearch":[4,"filter-with-search"],"highlightWithSearch":[4,"highlight-with-search"],"search":[32],"certificatesDecoded":[32],"expandedRow":[32],"certificateSelectedForDetails":[32],"isDecodeInProcess":[32]}]]],["peculiar-attribute-certificate-viewer_2",[[1,"peculiar-attribute-certificate-viewer",{"certificate":[1],"download":[4],"authKeyIdParentLink":[513,"auth-key-id-parent-link"],"authKeyIdSiblingsLink":[513,"auth-key-id-siblings-link"],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"isDecodeInProcess":[32]}],[1,"peculiar-csr-viewer",{"certificate":[513],"download":[4],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"view":[513],"isDecodeInProcess":[32]}]]],["peculiar-certificate-viewer",[[1,"peculiar-certificate-viewer",{"certificate":[513],"download":[516],"authKeyIdParentLink":[513,"auth-key-id-parent-link"],"authKeyIdSiblingsLink":[513,"auth-key-id-siblings-link"],"subjectKeyIdChildrenLink":[513,"subject-key-id-children-link"],"subjectKeyIdSiblingsLink":[513,"subject-key-id-siblings-link"],"issuerDnLink":[513,"issuer-dn-link"],"view":[513],"isDecodeInProcess":[32]}]]],["peculiar-certificate-decoder",[[1,"peculiar-certificate-decoder",{"certificateExample":[1,"certificate-example"],"defaultCertificate":[1,"default-certificate"],"certificateDecoded":[32]}]]],["peculiar-certificate-summary_3",[[1,"peculiar-certificate-summary",{"certificate":[16],"showIssuer":[4,"show-issuer"]}],[1,"peculiar-circular-progress",{"size":[2],"width":[2]}],[1,"peculiar-highlight-words",{"search":[1]}]]]], options);
17
17
  });
18
18
  };
19
19
 
@@ -0,0 +1,474 @@
1
+ /*!
2
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
+ */
4
+ import { h, r as registerInstance, H as Host } from './index-bbd484d9.js';
5
+ import { O as OIDs, P as Name, y as ActivityDescription, W as WebGDPR, I as InsuranceValue, T as TypeRelationship, V as ValuationRanking, U as UnstructuredName, t as ChallengePassword } from './certification_request-c0674647.js';
6
+ import { b as build } from './index-0ba131b0.js';
7
+ import { l as l10n } from './l10n-ac28fa92.js';
8
+ import { X as X509AttributeCertificate } from './x509_attribute_certificate-a6d4aa15.js';
9
+ import { g as getStringByOID, R as RowValue, G as GeneralNamePart, a as RowTitle, B as BasicInformation, S as Signature, T as Thumbprints, b as getLEILink, c as getDNSNameLink, d as getIPAddressLink, E as Extensions, M as Miscellaneous, e as SubjectName, P as PublicKey } from './public_key-43b2cbf0.js';
10
+ import { C as CSR } from './csr-c1b6a176.js';
11
+ import './_commonjsHelpers-bfbd2ad8.js';
12
+ import './download-735fb2eb.js';
13
+
14
+ /**
15
+ * @license
16
+ * Copyright (c) Peculiar Ventures, LLC.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ const BasicAttribute = (props, children) => {
22
+ const { attribute } = props;
23
+ return ([
24
+ h(RowValue, { name: "Name", value: getStringByOID(attribute.asn.type) }),
25
+ children,
26
+ h("tr", null,
27
+ h("td", { colSpan: 2, class: "divider" },
28
+ h("span", { class: "bg_fill" }))),
29
+ ]);
30
+ };
31
+
32
+ /**
33
+ * @license
34
+ * Copyright (c) Peculiar Ventures, LLC.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+ const NamePart = (props) => {
40
+ const { name } = props;
41
+ if (!name) {
42
+ return null;
43
+ }
44
+ return name.map((relativeDistinguishedName) => (relativeDistinguishedName.map((attributeTypeAndValue) => (h(RowValue, { name: OIDs[attributeTypeAndValue.type] || attributeTypeAndValue.type, value: attributeTypeAndValue.value.toString() })))));
45
+ };
46
+
47
+ /**
48
+ * @license
49
+ * Copyright (c) Peculiar Ventures, LLC.
50
+ *
51
+ * This source code is licensed under the MIT license found in the
52
+ * LICENSE file in the root directory of this source tree.
53
+ */
54
+ const NameAttribute = (props) => {
55
+ const { attribute } = props;
56
+ return (h(BasicAttribute, { attribute: attribute },
57
+ h(NamePart, { name: attribute.value })));
58
+ };
59
+
60
+ /**
61
+ * @license
62
+ * Copyright (c) Peculiar Ventures, LLC.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE file in the root directory of this source tree.
66
+ */
67
+ const ActivityDescriptionAttribute = (props) => {
68
+ const { attribute } = props;
69
+ return (h(BasicAttribute, { attribute: attribute },
70
+ h(RowValue, { name: "Code Authority", value: "" }),
71
+ h(GeneralNamePart, { generalName: attribute.value.codeAuthority, getDNSNameLink: () => '', getIPAddressLink: () => '' }),
72
+ h(RowValue, { name: "Code Id", value: "" }),
73
+ h(GeneralNamePart, { generalName: attribute.value.codeId, getDNSNameLink: () => '', getIPAddressLink: () => '' }),
74
+ h(RowValue, { name: "Short Name", value: attribute.value.shortName }),
75
+ h(RowValue, { name: "Short Description", value: attribute.value.shortDescription })));
76
+ };
77
+
78
+ /**
79
+ * @license
80
+ * Copyright (c) Peculiar Ventures, LLC.
81
+ *
82
+ * This source code is licensed under the MIT license found in the
83
+ * LICENSE file in the root directory of this source tree.
84
+ */
85
+ const WebGdprAttribute = (props) => {
86
+ const { attribute } = props;
87
+ return (h(BasicAttribute, { attribute: attribute },
88
+ h(RowValue, { name: "Assessment Authority", value: "" }),
89
+ h(GeneralNamePart, { generalName: attribute.value.assessmentAuthority, getDNSNameLink: () => '', getIPAddressLink: () => '' }),
90
+ h(RowValue, { name: "Assessment Location", value: "" }),
91
+ h(GeneralNamePart, { generalName: attribute.value.assessmentLocation, getDNSNameLink: () => '', getIPAddressLink: () => '' }),
92
+ h(RowValue, { name: "Assessment Ref", value: "" }),
93
+ h(GeneralNamePart, { generalName: attribute.value.assessmentRef, getDNSNameLink: () => '', getIPAddressLink: () => '' }),
94
+ h(RowValue, { name: "Data Storage Territory", value: attribute.value.dataStorageTerritory }),
95
+ h(RowValue, { name: "Description", value: attribute.value.description })));
96
+ };
97
+
98
+ /**
99
+ * @license
100
+ * Copyright (c) Peculiar Ventures, LLC.
101
+ *
102
+ * This source code is licensed under the MIT license found in the
103
+ * LICENSE file in the root directory of this source tree.
104
+ */
105
+ const InsuranceValueAttribute = (props) => {
106
+ const { attribute } = props;
107
+ const value = `${attribute.value.base} * 10^${attribute.value.degree} ${attribute.value.location}`;
108
+ return (h(BasicAttribute, { attribute: attribute },
109
+ h(RowValue, { name: "Value", value: value })));
110
+ };
111
+
112
+ /**
113
+ * @license
114
+ * Copyright (c) Peculiar Ventures, LLC.
115
+ *
116
+ * This source code is licensed under the MIT license found in the
117
+ * LICENSE file in the root directory of this source tree.
118
+ */
119
+ const TypeRelationshipAttribute = (props) => {
120
+ const { attribute } = props;
121
+ return (h(BasicAttribute, { attribute: attribute }, Object.keys(attribute.value).map((keyName) => (h(RowValue, { name: keyName, value: attribute.value[keyName].toNumber() ? 'YES' : 'NO' })))));
122
+ };
123
+
124
+ /**
125
+ * @license
126
+ * Copyright (c) Peculiar Ventures, LLC.
127
+ *
128
+ * This source code is licensed under the MIT license found in the
129
+ * LICENSE file in the root directory of this source tree.
130
+ */
131
+ const getValueRank = (value) => {
132
+ let ratio = 1;
133
+ if (value / 100 > 1) {
134
+ ratio = 100;
135
+ }
136
+ else if (value / 10 > 1) {
137
+ ratio = 10;
138
+ }
139
+ return `${value}/${5 * ratio}`;
140
+ };
141
+ const ValuationRankingAttribute = (props) => {
142
+ const { attribute } = props;
143
+ const values = Object.keys(attribute.value).map((keyName) => ([
144
+ getValueRank(attribute.value[keyName]),
145
+ h("br", null),
146
+ ]));
147
+ return (h(BasicAttribute, { attribute: attribute },
148
+ h(RowValue, { name: "Value", value: values })));
149
+ };
150
+
151
+ /**
152
+ * @license
153
+ * Copyright (c) Peculiar Ventures, LLC.
154
+ *
155
+ * This source code is licensed under the MIT license found in the
156
+ * LICENSE file in the root directory of this source tree.
157
+ */
158
+ const AsStringAttribute = (props) => {
159
+ const { attribute } = props;
160
+ return (h(BasicAttribute, { attribute: attribute },
161
+ h(RowValue, { name: "Value", value: attribute.value, monospace: true })));
162
+ };
163
+
164
+ /**
165
+ * @license
166
+ * Copyright (c) Peculiar Ventures, LLC.
167
+ *
168
+ * This source code is licensed under the MIT license found in the
169
+ * LICENSE file in the root directory of this source tree.
170
+ */
171
+ const UnstructuredNameAttribute = (props) => {
172
+ const { attribute } = props;
173
+ return (h(BasicAttribute, { attribute: attribute },
174
+ h(RowValue, { name: "Value", value: attribute.value.utf8String })));
175
+ };
176
+
177
+ /**
178
+ * @license
179
+ * Copyright (c) Peculiar Ventures, LLC.
180
+ *
181
+ * This source code is licensed under the MIT license found in the
182
+ * LICENSE file in the root directory of this source tree.
183
+ */
184
+ const ChallengePasswordAttribute = (props) => {
185
+ const { attribute } = props;
186
+ return (h(BasicAttribute, { attribute: attribute },
187
+ h(RowValue, { name: "Value", value: attribute.value.toString() })));
188
+ };
189
+
190
+ /**
191
+ * @license
192
+ * Copyright (c) Peculiar Ventures, LLC.
193
+ *
194
+ * This source code is licensed under the MIT license found in the
195
+ * LICENSE file in the root directory of this source tree.
196
+ */
197
+ const Attributes = (props) => {
198
+ const { attributes } = props;
199
+ if (!attributes || !attributes.length) {
200
+ return null;
201
+ }
202
+ return ([
203
+ h(RowTitle, { value: "Attributes" }),
204
+ attributes.map((attribute) => {
205
+ try {
206
+ if (attribute.value instanceof Name) {
207
+ return (h(NameAttribute, { attribute: attribute }));
208
+ }
209
+ if (attribute.value instanceof ActivityDescription) {
210
+ return (h(ActivityDescriptionAttribute, { attribute: attribute }));
211
+ }
212
+ if (attribute.value instanceof WebGDPR) {
213
+ return (h(WebGdprAttribute, { attribute: attribute }));
214
+ }
215
+ if (attribute.value instanceof InsuranceValue) {
216
+ return (h(InsuranceValueAttribute, { attribute: attribute }));
217
+ }
218
+ if (attribute.value instanceof TypeRelationship) {
219
+ return (h(TypeRelationshipAttribute, { attribute: attribute }));
220
+ }
221
+ if (attribute.value instanceof ValuationRanking) {
222
+ return (h(ValuationRankingAttribute, { attribute: attribute }));
223
+ }
224
+ if (attribute.value instanceof UnstructuredName) {
225
+ return (h(UnstructuredNameAttribute, { attribute: attribute }));
226
+ }
227
+ if (attribute.value instanceof ChallengePassword) {
228
+ return (h(ChallengePasswordAttribute, { attribute: attribute }));
229
+ }
230
+ if (typeof attribute.value === 'string') {
231
+ return (h(AsStringAttribute, { attribute: attribute }));
232
+ }
233
+ return (h(BasicAttribute, { attribute: attribute }));
234
+ }
235
+ catch (error) {
236
+ console.error('Error render attribute:', attribute.asn.type);
237
+ return null;
238
+ }
239
+ }),
240
+ ]);
241
+ };
242
+
243
+ /**
244
+ * @license
245
+ * Copyright (c) Peculiar Ventures, LLC.
246
+ *
247
+ * This source code is licensed under the MIT license found in the
248
+ * LICENSE file in the root directory of this source tree.
249
+ */
250
+ const Issuer = (props) => {
251
+ const { issuer } = props;
252
+ if (!issuer) {
253
+ return null;
254
+ }
255
+ return [
256
+ h(RowTitle, { value: l10n.getString('issuer') }),
257
+ issuer.map((item) => (h(GeneralNamePart, { generalName: item, getDNSNameLink: () => '', getIPAddressLink: () => '' }))),
258
+ ];
259
+ };
260
+
261
+ /**
262
+ * @license
263
+ * Copyright (c) Peculiar Ventures, LLC.
264
+ *
265
+ * This source code is licensed under the MIT license found in the
266
+ * LICENSE file in the root directory of this source tree.
267
+ */
268
+ const Holder = (props) => {
269
+ const { holder } = props;
270
+ if (!holder) {
271
+ return null;
272
+ }
273
+ const { baseCertificateID, objectDigestInfo } = holder;
274
+ return [
275
+ h(RowTitle, { value: l10n.getString('holder') }),
276
+ baseCertificateID && ([
277
+ baseCertificateID.issuer.map((item) => (h(GeneralNamePart, { generalName: item, getDNSNameLink: () => '', getIPAddressLink: () => '' }))),
278
+ h("tr", null,
279
+ h("td", null),
280
+ h("td", null)),
281
+ h(RowValue, { name: l10n.getString('serialNumber'), value: build.Convert.ToHex(baseCertificateID.serial), monospace: true }),
282
+ h("tr", null,
283
+ h("td", null),
284
+ h("td", null)),
285
+ ]),
286
+ objectDigestInfo && ([
287
+ h(RowValue, { name: l10n.getString('digestInfo'), value: "" }),
288
+ h(RowValue, { name: l10n.getString('algorithm'), value: getStringByOID(objectDigestInfo.digestAlgorithm.algorithm) }),
289
+ h(RowValue, { name: l10n.getString('value'), value: build.Convert.ToHex(objectDigestInfo.objectDigest), monospace: true }),
290
+ h(RowValue, { name: l10n.getString('type'), value: objectDigestInfo.digestedObjectType }),
291
+ ]),
292
+ ];
293
+ };
294
+
295
+ const certificateViewerCss$1 = ":host{-webkit-box-sizing:border-box;box-sizing:border-box}:host *,:host *:before,:host *:after{-webkit-box-sizing:inherit;box-sizing:inherit}:host{display:block;width:100%;word-wrap:break-word;position:relative;min-width:280px;min-height:300px;background:white;background:rgba(var(--pv-color-light-rgb), 1)}th,td{border:none}table{width:100%;margin-bottom:30px;border-spacing:0;border-collapse:collapse}table .title td{border-color:rgba(209, 213, 217, 0.5);border-color:rgba(var(--pv-color-grey_3-rgb), 0.5);padding-top:60px;padding-bottom:15px;border-bottom-width:1px;border-bottom-style:solid}table td:first-child{padding-left:30px;width:130px;padding-right:10px}table td:last-child{padding-right:30px;width:calc(100% - 130px)}table td{vertical-align:top;padding-top:5px;padding-bottom:5px}table td.vertical_align_middle{vertical-align:middle}table .title:first-child td{padding-top:15px}table .title+tr td{padding-top:15px}table td.monospace{max-width:0}table .divider{padding-top:15px;padding-bottom:15px}.divider .bg_fill{background-color:rgba(209, 213, 217, 0.5);background-color:rgba(var(--pv-color-grey_3-rgb), 0.5)}table tr:last-child .divider{padding-top:0;opacity:0}.divider span{display:block;height:1px}.status_wrapper{min-height:inherit;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.interaction_text{padding:15px 0;width:300px;margin:auto;text-align:center}@media (max-width: 900px){table,tr,td{display:block}table td:last-child,table td:first-child{padding-right:15px;padding-left:15px;width:100%}table .title+tr td{padding-top:5px}table .title+tr td:first-child{padding-top:15px}table td.monospace{width:100%;max-width:none}}:host([data-view=mobile]) table,:host([data-view=mobile]) tr,:host([data-view=mobile]) td{display:block}:host([data-view=mobile]) table td:last-child,:host([data-view=mobile]) table td:first-child{padding-right:15px;padding-left:15px;width:100%}:host([data-view=mobile]) table .title+tr td{padding-top:5px}:host([data-view=mobile]) table .title+tr td:first-child{padding-top:15px}:host([data-view=mobile]) table td.monospace{width:100%;max-width:none}";
296
+
297
+ const AttributeCertificateViewer = class {
298
+ constructor(hostRef) {
299
+ registerInstance(this, hostRef);
300
+ this.isDecodeInProcess = true;
301
+ this.getAuthKeyIdParentLink = (value) => {
302
+ var _a;
303
+ return (_a = this.authKeyIdParentLink) === null || _a === void 0 ? void 0 : _a.replace('{{authKeyId}}', value);
304
+ };
305
+ this.getAuthKeyIdSiblingsLink = (value) => {
306
+ var _a;
307
+ return (_a = this.authKeyIdSiblingsLink) === null || _a === void 0 ? void 0 : _a.replace('{{authKeyId}}', value);
308
+ };
309
+ this.getSubjectKeyIdChildrenLink = (value) => {
310
+ var _a;
311
+ return (_a = this.subjectKeyIdChildrenLink) === null || _a === void 0 ? void 0 : _a.replace('{{subjectKeyId}}', value);
312
+ };
313
+ this.getSubjectKeyIdSiblingsLink = (value) => {
314
+ var _a;
315
+ return (_a = this.subjectKeyIdSiblingsLink) === null || _a === void 0 ? void 0 : _a.replace('{{subjectKeyId}}', value);
316
+ };
317
+ }
318
+ componentWillLoad() {
319
+ this.decodeCertificate(this.certificate);
320
+ }
321
+ async decodeCertificate(certificate) {
322
+ this.isDecodeInProcess = true;
323
+ try {
324
+ if (certificate instanceof X509AttributeCertificate) {
325
+ this.certificateDecoded = certificate;
326
+ }
327
+ else if (typeof certificate === 'string') {
328
+ this.certificateDecoded = new X509AttributeCertificate(certificate);
329
+ }
330
+ else {
331
+ return;
332
+ }
333
+ this.certificateDecoded.parseExtensions();
334
+ this.certificateDecoded.parseAttributes();
335
+ await this.certificateDecoded.getThumbprint('SHA-1');
336
+ await this.certificateDecoded.getThumbprint('SHA-256');
337
+ }
338
+ catch (error) {
339
+ this.certificateDecodeError = error;
340
+ console.error('Error certificate parse:', error);
341
+ }
342
+ this.isDecodeInProcess = false;
343
+ }
344
+ /**
345
+ * Rerun decodeCertificate if previuos value not equal current value
346
+ */
347
+ watchCertificateAndDecode(newValue, oldValue) {
348
+ if (typeof newValue === 'string' && typeof oldValue === 'string') {
349
+ if (newValue !== oldValue) {
350
+ this.decodeCertificate(newValue);
351
+ }
352
+ return;
353
+ }
354
+ if (newValue instanceof X509AttributeCertificate
355
+ && oldValue instanceof X509AttributeCertificate) {
356
+ if (newValue.serialNumber !== oldValue.serialNumber) {
357
+ this.decodeCertificate(newValue);
358
+ }
359
+ }
360
+ }
361
+ // eslint-disable-next-line class-methods-use-this
362
+ renderErrorState() {
363
+ return (h("div", { class: "status_wrapper" }, h("peculiar-typography", { type: "b1", class: "interaction_text" }, "There was an error decoding this attribute certificate.")));
364
+ }
365
+ // eslint-disable-next-line class-methods-use-this
366
+ renderEmptyState() {
367
+ return (h("div", { class: "status_wrapper" }, h("peculiar-typography", { type: "b1", class: "interaction_text" }, "There is no attribute certificate available.")));
368
+ }
369
+ render() {
370
+ if (this.certificateDecodeError) {
371
+ return this.renderErrorState();
372
+ }
373
+ if (!this.certificateDecoded) {
374
+ return this.renderEmptyState();
375
+ }
376
+ return (h(Host, null, h("table", null, h(BasicInformation, Object.assign({}, this.certificateDecoded)), h(Issuer, { issuer: this.certificateDecoded.issuer }), h(Holder, { holder: this.certificateDecoded.holder }), h(Signature, { signature: this.certificateDecoded.signature }), h(Thumbprints, { thumbprints: this.certificateDecoded.thumbprints }), h(Attributes, { attributes: this.certificateDecoded.attributes, getLEILink: getLEILink, getDNSNameLink: getDNSNameLink, getIPAddressLink: getIPAddressLink, getAuthKeyIdParentLink: this.getAuthKeyIdParentLink, getAuthKeyIdSiblingsLink: this.getAuthKeyIdSiblingsLink, getSubjectKeyIdChildrenLink: this.getSubjectKeyIdChildrenLink, getSubjectKeyIdSiblingsLink: this.getSubjectKeyIdSiblingsLink }), 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 })))));
377
+ }
378
+ static get watchers() { return {
379
+ "certificate": ["watchCertificateAndDecode"]
380
+ }; }
381
+ };
382
+ AttributeCertificateViewer.style = certificateViewerCss$1;
383
+
384
+ const certificateViewerCss = ":host{-webkit-box-sizing:border-box;box-sizing:border-box}:host *,:host *:before,:host *:after{-webkit-box-sizing:inherit;box-sizing:inherit}:host{display:block;width:100%;word-wrap:break-word;position:relative;min-width:280px;min-height:300px;background:white;background:rgba(var(--pv-color-light-rgb), 1)}th,td{border:none}table{width:100%;margin-bottom:30px;border-spacing:0;border-collapse:collapse}table .title td{border-color:rgba(209, 213, 217, 0.5);border-color:rgba(var(--pv-color-grey_3-rgb), 0.5);padding-top:60px;padding-bottom:15px;border-bottom-width:1px;border-bottom-style:solid}table td:first-child{padding-left:30px;width:130px;padding-right:10px}table td:last-child{padding-right:30px;width:calc(100% - 130px)}table td{vertical-align:top;padding-top:5px;padding-bottom:5px}table td.vertical_align_middle{vertical-align:middle}table .title:first-child td{padding-top:15px}table .title+tr td{padding-top:15px}table td.monospace{max-width:0}table .divider{padding-top:15px;padding-bottom:15px}.divider .bg_fill{background-color:rgba(209, 213, 217, 0.5);background-color:rgba(var(--pv-color-grey_3-rgb), 0.5)}table tr:last-child .divider{padding-top:0;opacity:0}.divider span{display:block;height:1px}.status_wrapper{min-height:inherit;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.interaction_text{padding:15px 0;width:300px;margin:auto;text-align:center}@media (max-width: 900px){table,tr,td{display:block}table td:last-child,table td:first-child{padding-right:15px;padding-left:15px;width:100%}table .title+tr td{padding-top:5px}table .title+tr td:first-child{padding-top:15px}table td.monospace{width:100%;max-width:none}}:host([data-view=mobile]) table,:host([data-view=mobile]) tr,:host([data-view=mobile]) td{display:block}:host([data-view=mobile]) table td:last-child,:host([data-view=mobile]) table td:first-child{padding-right:15px;padding-left:15px;width:100%}:host([data-view=mobile]) table .title+tr td{padding-top:5px}:host([data-view=mobile]) table .title+tr td:first-child{padding-top:15px}:host([data-view=mobile]) table td.monospace{width:100%;max-width:none}";
385
+
386
+ const CsrViewer = class {
387
+ constructor(hostRef) {
388
+ registerInstance(this, hostRef);
389
+ this.isDecodeInProcess = true;
390
+ this.getAuthKeyIdParentLink = (value) => value;
391
+ this.getAuthKeyIdSiblingsLink = (value) => value;
392
+ this.getSubjectKeyIdChildrenLink = (value) => {
393
+ var _a;
394
+ return (_a = this.subjectKeyIdChildrenLink) === null || _a === void 0 ? void 0 : _a.replace('{{subjectKeyId}}', value);
395
+ };
396
+ this.getSubjectKeyIdSiblingsLink = (value) => {
397
+ var _a;
398
+ return (_a = this.subjectKeyIdSiblingsLink) === null || _a === void 0 ? void 0 : _a.replace('{{subjectKeyId}}', value);
399
+ };
400
+ }
401
+ componentWillLoad() {
402
+ this.decodeCertificate(this.certificate);
403
+ }
404
+ async decodeCertificate(certificate) {
405
+ this.isDecodeInProcess = true;
406
+ try {
407
+ if (certificate instanceof CSR) {
408
+ this.certificateDecoded = certificate;
409
+ }
410
+ else if (typeof certificate === 'string') {
411
+ this.certificateDecoded = new CSR(certificate);
412
+ }
413
+ else {
414
+ return;
415
+ }
416
+ this.certificateDecoded.parseAttributes();
417
+ await this.certificateDecoded.getThumbprint('SHA-1');
418
+ await this.certificateDecoded.getThumbprint('SHA-256');
419
+ }
420
+ catch (error) {
421
+ this.certificateDecodeError = error;
422
+ console.error('Error certificate parse:', error);
423
+ }
424
+ this.isDecodeInProcess = false;
425
+ }
426
+ /**
427
+ * Rerun decodeCertificate if previuos value not equal current value
428
+ */
429
+ watchCertificateAndDecode(newValue, oldValue) {
430
+ if (typeof newValue === 'string' && typeof oldValue === 'string') {
431
+ if (newValue !== oldValue) {
432
+ this.decodeCertificate(newValue);
433
+ }
434
+ return;
435
+ }
436
+ if (newValue instanceof CSR
437
+ && oldValue instanceof CSR) {
438
+ if (newValue.commonName !== oldValue.commonName) {
439
+ this.decodeCertificate(newValue);
440
+ }
441
+ }
442
+ }
443
+ // eslint-disable-next-line class-methods-use-this
444
+ renderErrorState() {
445
+ return (h("div", { class: "status_wrapper" }, h("peculiar-typography", { type: "b1", class: "interaction_text" }, "There was an error decoding this certificate request.")));
446
+ }
447
+ // eslint-disable-next-line class-methods-use-this
448
+ renderEmptyState() {
449
+ return (h("div", { class: "status_wrapper" }, h("peculiar-typography", { type: "b1", class: "interaction_text" }, "There is no certificate request available.")));
450
+ }
451
+ getExtensionRequestAttribute() {
452
+ if (!this.certificateDecoded) {
453
+ return undefined;
454
+ }
455
+ return this.certificateDecoded.attributes
456
+ .find((attribute) => attribute.asn.type === '1.2.840.113549.1.9.14');
457
+ }
458
+ render() {
459
+ if (this.certificateDecodeError) {
460
+ return this.renderErrorState();
461
+ }
462
+ if (!this.certificateDecoded) {
463
+ return this.renderEmptyState();
464
+ }
465
+ const extensionRequestAttribute = this.getExtensionRequestAttribute();
466
+ return (h(Host, { "data-view": this.view }, h("table", null, h(BasicInformation, Object.assign({}, this.certificateDecoded)), h(SubjectName, { name: this.certificateDecoded.subject }), h(PublicKey, { publicKey: this.certificateDecoded.publicKey }), h(Signature, { signature: this.certificateDecoded.signature }), h(Thumbprints, { thumbprints: this.certificateDecoded.thumbprints }), h(Attributes, { attributes: this.certificateDecoded.attributes, getLEILink: getLEILink, getDNSNameLink: getDNSNameLink, getIPAddressLink: getIPAddressLink, getAuthKeyIdParentLink: this.getAuthKeyIdParentLink, getAuthKeyIdSiblingsLink: this.getAuthKeyIdSiblingsLink, getSubjectKeyIdChildrenLink: this.getSubjectKeyIdChildrenLink, getSubjectKeyIdSiblingsLink: this.getSubjectKeyIdSiblingsLink }), h(Extensions, { extensions: extensionRequestAttribute === null || extensionRequestAttribute === void 0 ? void 0 : extensionRequestAttribute.value, title: "Extension Request", 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 })))));
467
+ }
468
+ static get watchers() { return {
469
+ "certificate": ["watchCertificateAndDecode"]
470
+ }; }
471
+ };
472
+ CsrViewer.style = certificateViewerCss;
473
+
474
+ export { AttributeCertificateViewer as peculiar_attribute_certificate_viewer, CsrViewer as peculiar_csr_viewer };