@peculiar/certificates-viewer 3.0.4 → 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.
- package/dist/cjs/{certification_request-43396146.js → certification_request-cde57123.js} +138 -266
- package/dist/cjs/csr-78378ed0.js +150 -0
- package/dist/cjs/download-6724f3a7.js +79 -0
- package/dist/cjs/{download-5e7d5455.js → index-ff818d4d.js} +0 -72
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/l10n-a048a686.js +145 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/peculiar-attribute-certificate-viewer_2.cjs.entry.js +479 -0
- package/dist/cjs/peculiar-button_5.cjs.entry.js +148 -0
- package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +173 -0
- package/dist/cjs/peculiar-certificate-summary_3.cjs.entry.js +1 -1
- package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +124 -0
- package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +6 -4
- package/dist/cjs/peculiar.cjs.js +1 -1
- package/dist/cjs/public_key-e56dbe52.js +1104 -0
- package/dist/cjs/x509_attribute_certificate-cc325b70.js +87 -0
- package/dist/cjs/x509_certificate-51a97033.js +139 -0
- package/dist/collection/components/certificate-decoder/certificate-decoder.js +54 -11
- package/dist/collection/constants/oids.js +1 -0
- package/dist/collection/utils/index.js +0 -1
- package/dist/collection/www-copy/index.js +80 -0
- package/dist/esm/{certification_request-16ea346c.js → certification_request-c0674647.js} +77 -205
- package/dist/esm/csr-c1b6a176.js +147 -0
- package/dist/esm/download-735fb2eb.js +76 -0
- package/dist/esm/{download-cf68ac2c.js → index-0ba131b0.js} +1 -71
- package/dist/esm/index.js +2 -1
- package/dist/esm/l10n-ac28fa92.js +141 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/peculiar-attribute-certificate-viewer_2.entry.js +474 -0
- package/dist/esm/peculiar-button_5.entry.js +140 -0
- package/dist/esm/peculiar-certificate-decoder.entry.js +169 -0
- package/dist/esm/peculiar-certificate-summary_3.entry.js +1 -1
- package/dist/esm/peculiar-certificate-viewer.entry.js +120 -0
- package/dist/esm/peculiar-certificates-viewer.entry.js +5 -3
- package/dist/esm/peculiar.js +1 -1
- package/dist/esm/public_key-43b2cbf0.js +1089 -0
- package/dist/esm/x509_attribute_certificate-a6d4aa15.js +85 -0
- package/dist/esm/x509_certificate-12f6d344.js +137 -0
- package/dist/peculiar/index.esm.js +1 -1
- package/dist/peculiar/p-006865d7.js +4 -0
- package/dist/peculiar/p-17c4da7b.js +11 -0
- package/dist/peculiar/p-1ebab45c.js +78 -0
- package/dist/peculiar/{p-b09a1f0b.entry.js → p-38635919.entry.js} +1 -1
- package/dist/peculiar/p-3f8d1008.entry.js +4 -0
- package/dist/peculiar/p-42da7f97.js +11 -0
- package/dist/peculiar/p-464e0943.js +87 -0
- package/dist/peculiar/p-4f4c1d30.js +12 -0
- package/dist/peculiar/p-530afe84.entry.js +11 -0
- package/dist/peculiar/p-6011646e.entry.js +11 -0
- package/dist/peculiar/p-6c510523.js +18 -0
- package/dist/peculiar/p-d7a13cb4.js +18 -0
- package/dist/peculiar/p-dafae164.entry.js +4 -0
- package/dist/peculiar/p-e77d0ccc.entry.js +18 -0
- package/dist/peculiar/peculiar.esm.js +1 -1
- package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +13 -0
- package/dist/types/components.d.ts +20 -0
- package/dist/types/constants/oids.d.ts +1 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/package.json +2 -3
- package/dist/cjs/l10n-d4a77087.js +0 -767
- package/dist/cjs/peculiar-attribute-certificate-viewer_9.cjs.entry.js +0 -2175
- package/dist/collection/utils/history.js +0 -19
- package/dist/collection/utils/parse_hash.js +0 -28
- package/dist/collection/utils/query_stringify.js +0 -21
- package/dist/esm/l10n-9ac63748.js +0 -762
- package/dist/esm/peculiar-attribute-certificate-viewer_9.entry.js +0 -2163
- package/dist/peculiar/p-7452b86e.entry.js +0 -4
- package/dist/peculiar/p-99797a49.js +0 -34
- package/dist/peculiar/p-c774ec0b.js +0 -18
- package/dist/peculiar/p-d0db9e70.entry.js +0 -113
- package/dist/peculiar/p-d7ed39f0.js +0 -87
- package/dist/types/utils/history.d.ts +0 -9
- package/dist/types/utils/parse_hash.d.ts +0 -9
- package/dist/types/utils/query_stringify.d.ts +0 -8
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const certification_request = require('./certification_request-cde57123.js');
|
|
7
|
+
const index = require('./index-ff818d4d.js');
|
|
8
|
+
const l10n = require('./l10n-a048a686.js');
|
|
9
|
+
const csr = require('./csr-78378ed0.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
class X509AttributeCertificate extends certification_request.AsnData {
|
|
19
|
+
constructor(raw) {
|
|
20
|
+
var _a;
|
|
21
|
+
super(certification_request.certificateRawToBuffer(raw), certification_request.AttributeCertificate);
|
|
22
|
+
this.thumbprints = {};
|
|
23
|
+
this.type = 'X.509 Attribute Certificate';
|
|
24
|
+
const { acinfo } = this.asn;
|
|
25
|
+
this.serialNumber = index.build.Convert.ToHex(acinfo.serialNumber);
|
|
26
|
+
this.version = acinfo.version;
|
|
27
|
+
const notBefore = acinfo.attrCertValidityPeriod.notBeforeTime;
|
|
28
|
+
if (!notBefore) {
|
|
29
|
+
throw new Error("Cannot get 'notBefore' value");
|
|
30
|
+
}
|
|
31
|
+
this.notBefore = notBefore;
|
|
32
|
+
const notAfter = acinfo.attrCertValidityPeriod.notAfterTime;
|
|
33
|
+
if (!notAfter) {
|
|
34
|
+
throw new Error("Cannot get 'notAfter' value");
|
|
35
|
+
}
|
|
36
|
+
this.notAfter = notAfter;
|
|
37
|
+
this.validity = l10n.dateDiff(this.notBefore, this.notAfter);
|
|
38
|
+
this.issuer = acinfo.issuer.v1Form || ((_a = acinfo.issuer.v2Form) === null || _a === void 0 ? void 0 : _a.issuerName);
|
|
39
|
+
this.holder = acinfo.holder;
|
|
40
|
+
}
|
|
41
|
+
get signature() {
|
|
42
|
+
const { signatureValue, signatureAlgorithm } = this.asn;
|
|
43
|
+
return {
|
|
44
|
+
value: signatureValue,
|
|
45
|
+
algorithm: signatureAlgorithm.algorithm,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
parseExtensions() {
|
|
49
|
+
const { acinfo } = this.asn;
|
|
50
|
+
if (acinfo.extensions) {
|
|
51
|
+
this.extensions = acinfo.extensions
|
|
52
|
+
.map((e) => new certification_request.Extension(certification_request.AsnConvert.serialize(e)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
parseAttributes() {
|
|
56
|
+
const { acinfo } = this.asn;
|
|
57
|
+
if (acinfo.attributes) {
|
|
58
|
+
this.attributes = acinfo.attributes
|
|
59
|
+
.map((e) => new csr.Attribute(certification_request.AsnConvert.serialize(e)));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async getThumbprint(algorithm = 'SHA-1') {
|
|
63
|
+
try {
|
|
64
|
+
const thumbprint = await certification_request.getCertificateThumbprint(algorithm, this.raw);
|
|
65
|
+
if (thumbprint) {
|
|
66
|
+
this.thumbprints[algorithm['name'] || algorithm] = index.build.Convert.ToHex(thumbprint);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error('Error thumbprint get:', error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exportAsBase64() {
|
|
74
|
+
return index.build.Convert.ToBase64(this.raw);
|
|
75
|
+
}
|
|
76
|
+
exportAsHexFormatted() {
|
|
77
|
+
return certification_request.hexFormat(index.build.Convert.ToHex(this.raw));
|
|
78
|
+
}
|
|
79
|
+
exportAsPemFormatted() {
|
|
80
|
+
return `-----BEGIN ATTRIBUTE CERTIFICATE-----\n${certification_request.base64Format(this.exportAsBase64())}\n-----END ATTRIBUTE CERTIFICATE-----`;
|
|
81
|
+
}
|
|
82
|
+
get commonName() {
|
|
83
|
+
return `attribute-certificate-${this.thumbprints['SHA-1']}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exports.X509AttributeCertificate = X509AttributeCertificate;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const certification_request = require('./certification_request-cde57123.js');
|
|
7
|
+
const index = require('./index-ff818d4d.js');
|
|
8
|
+
const l10n = require('./l10n-a048a686.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
class X509Certificate extends certification_request.AsnData {
|
|
18
|
+
constructor(raw) {
|
|
19
|
+
super(certification_request.certificateRawToBuffer(raw), certification_request.Certificate);
|
|
20
|
+
this.thumbprints = {};
|
|
21
|
+
this.type = 'X.509 Certificate';
|
|
22
|
+
const { tbsCertificate } = this.asn;
|
|
23
|
+
this.serialNumber = index.build.Convert.ToHex(tbsCertificate.serialNumber);
|
|
24
|
+
this.subject = new certification_request.Name(tbsCertificate.subject).toJSON();
|
|
25
|
+
this.issuer = new certification_request.Name(tbsCertificate.issuer).toJSON();
|
|
26
|
+
this.version = tbsCertificate.version + 1;
|
|
27
|
+
const notBefore = tbsCertificate.validity.notBefore.utcTime
|
|
28
|
+
|| tbsCertificate.validity.notBefore.generalTime;
|
|
29
|
+
if (!notBefore) {
|
|
30
|
+
throw new Error("Cannot get 'notBefore' value");
|
|
31
|
+
}
|
|
32
|
+
this.notBefore = notBefore;
|
|
33
|
+
const notAfter = tbsCertificate.validity.notAfter.utcTime
|
|
34
|
+
|| tbsCertificate.validity.notAfter.generalTime;
|
|
35
|
+
if (!notAfter) {
|
|
36
|
+
throw new Error("Cannot get 'notAfter' value");
|
|
37
|
+
}
|
|
38
|
+
this.notAfter = notAfter;
|
|
39
|
+
this.validity = l10n.dateDiff(this.notBefore, this.notAfter);
|
|
40
|
+
}
|
|
41
|
+
parseExtensions() {
|
|
42
|
+
const { tbsCertificate } = this.asn;
|
|
43
|
+
if (tbsCertificate.extensions) {
|
|
44
|
+
this.extensions = tbsCertificate.extensions
|
|
45
|
+
.map((e) => new certification_request.Extension(certification_request.AsnConvert.serialize(e)));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get publicKey() {
|
|
49
|
+
const { subjectPublicKey, algorithm } = this.asn.tbsCertificate.subjectPublicKeyInfo;
|
|
50
|
+
let params;
|
|
51
|
+
if (algorithm.algorithm === certification_request.id_ecPublicKey && algorithm.parameters) {
|
|
52
|
+
params = certification_request.AsnConvert.parse(algorithm.parameters, certification_request.ECParameters);
|
|
53
|
+
}
|
|
54
|
+
if (algorithm.algorithm === certification_request.id_rsaEncryption) {
|
|
55
|
+
params = certification_request.AsnConvert.parse(subjectPublicKey, certification_request.RSAPublicKey);
|
|
56
|
+
}
|
|
57
|
+
const spki = certification_request.AsnConvert.serialize(this.asn.tbsCertificate.subjectPublicKeyInfo);
|
|
58
|
+
return {
|
|
59
|
+
params,
|
|
60
|
+
value: spki,
|
|
61
|
+
algorithm: algorithm.algorithm,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
get signature() {
|
|
65
|
+
const { signatureValue, signatureAlgorithm } = this.asn;
|
|
66
|
+
return {
|
|
67
|
+
value: signatureValue,
|
|
68
|
+
algorithm: signatureAlgorithm.algorithm,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
exportAsBase64() {
|
|
72
|
+
return index.build.Convert.ToBase64(this.raw);
|
|
73
|
+
}
|
|
74
|
+
exportAsHexFormatted() {
|
|
75
|
+
return certification_request.hexFormat(index.build.Convert.ToHex(this.raw));
|
|
76
|
+
}
|
|
77
|
+
exportAsPemFormatted() {
|
|
78
|
+
return `-----BEGIN CERTIFICATE-----\n${certification_request.base64Format(this.exportAsBase64())}\n-----END CERTIFICATE-----`;
|
|
79
|
+
}
|
|
80
|
+
async getThumbprint(algorithm = 'SHA-1') {
|
|
81
|
+
try {
|
|
82
|
+
const thumbprint = await certification_request.getCertificateThumbprint(algorithm, this.raw);
|
|
83
|
+
if (thumbprint) {
|
|
84
|
+
this.thumbprints[algorithm['name'] || algorithm] = index.build.Convert.ToHex(thumbprint);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('Error thumbprint get:', error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
get commonName() {
|
|
92
|
+
if (!this.subject) {
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
for (let i = 0; i < this.subject.length; i += 1) {
|
|
96
|
+
const name = this.subject[i];
|
|
97
|
+
if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {
|
|
98
|
+
return name.value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
get issuerCommonName() {
|
|
104
|
+
if (!this.issuer) {
|
|
105
|
+
return '';
|
|
106
|
+
}
|
|
107
|
+
for (let i = 0; i < this.issuer.length; i += 1) {
|
|
108
|
+
const name = this.issuer[i];
|
|
109
|
+
if (name.shortName === 'CN') {
|
|
110
|
+
return name.value;
|
|
111
|
+
}
|
|
112
|
+
if (name.shortName === 'E') {
|
|
113
|
+
return name.value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
get isRoot() {
|
|
119
|
+
return JSON.stringify(this.issuer) === JSON.stringify(this.subject);
|
|
120
|
+
}
|
|
121
|
+
subjectToString() {
|
|
122
|
+
if (!this.subject) {
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
return this.subject
|
|
126
|
+
.map((name) => (`${name.shortName}=${name.value}`))
|
|
127
|
+
.join(', ');
|
|
128
|
+
}
|
|
129
|
+
issuerToString() {
|
|
130
|
+
if (!this.issuer) {
|
|
131
|
+
return '';
|
|
132
|
+
}
|
|
133
|
+
return this.issuer
|
|
134
|
+
.map((name) => (`${name.shortName}=${name.value}`))
|
|
135
|
+
.join(', ');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
exports.X509Certificate = X509Certificate;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
|
-
import { Component, Host, h, State, Prop, } from '@stencil/core';
|
|
12
|
-
import { validator,
|
|
11
|
+
import { Component, Host, h, State, Prop, Event, } from '@stencil/core';
|
|
12
|
+
import { validator, readAsBinaryString } from '../../utils';
|
|
13
13
|
import { X509Certificate, X509AttributeCertificate, CSR } from '../../crypto';
|
|
14
14
|
export class CertificateDecoder {
|
|
15
15
|
constructor() {
|
|
@@ -48,27 +48,22 @@ export class CertificateDecoder {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
componentDidLoad() {
|
|
51
|
-
|
|
52
|
-
if (parsedHash.cert) {
|
|
51
|
+
if (this.defaultCertificate) {
|
|
53
52
|
/**
|
|
54
53
|
* Prevent Stencil warning about re-render
|
|
55
54
|
*/
|
|
56
|
-
setTimeout(() => this.decode(
|
|
55
|
+
setTimeout(() => this.decode(this.defaultCertificate), 100);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
clearValue() {
|
|
60
59
|
this.inputPaste.value = '';
|
|
61
60
|
this.certificateDecoded = null;
|
|
62
|
-
|
|
61
|
+
this.clearCertificate.emit();
|
|
63
62
|
}
|
|
64
63
|
setValue(value) {
|
|
65
64
|
this.certificateDecoded = value;
|
|
66
65
|
this.inputPaste.value = value.exportAsPemFormatted();
|
|
67
|
-
|
|
68
|
-
search: history.queryStringify({
|
|
69
|
-
cert: value.exportAsBase64(),
|
|
70
|
-
}),
|
|
71
|
-
});
|
|
66
|
+
this.successParse.emit(value.exportAsBase64());
|
|
72
67
|
}
|
|
73
68
|
decode(certificate) {
|
|
74
69
|
const isPem = validator.isPem(certificate);
|
|
@@ -168,9 +163,57 @@ export class CertificateDecoder {
|
|
|
168
163
|
},
|
|
169
164
|
"attribute": "certificate-example",
|
|
170
165
|
"reflect": false
|
|
166
|
+
},
|
|
167
|
+
"defaultCertificate": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "string",
|
|
172
|
+
"resolved": "string",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": true,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": "The default certificate value for decode and show details. Use PEM or DER."
|
|
180
|
+
},
|
|
181
|
+
"attribute": "default-certificate",
|
|
182
|
+
"reflect": false
|
|
171
183
|
}
|
|
172
184
|
}; }
|
|
173
185
|
static get states() { return {
|
|
174
186
|
"certificateDecoded": {}
|
|
175
187
|
}; }
|
|
188
|
+
static get events() { return [{
|
|
189
|
+
"method": "successParse",
|
|
190
|
+
"name": "successParse",
|
|
191
|
+
"bubbles": true,
|
|
192
|
+
"cancelable": true,
|
|
193
|
+
"composed": true,
|
|
194
|
+
"docs": {
|
|
195
|
+
"tags": [],
|
|
196
|
+
"text": "Emitted when the certificate has been successfully parsed."
|
|
197
|
+
},
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "string",
|
|
200
|
+
"resolved": "string",
|
|
201
|
+
"references": {}
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
"method": "clearCertificate",
|
|
205
|
+
"name": "clearCertificate",
|
|
206
|
+
"bubbles": true,
|
|
207
|
+
"cancelable": true,
|
|
208
|
+
"composed": true,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": "Emitted when the certificate has been removed."
|
|
212
|
+
},
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "void",
|
|
215
|
+
"resolved": "void",
|
|
216
|
+
"references": {}
|
|
217
|
+
}
|
|
218
|
+
}]; }
|
|
176
219
|
}
|
|
@@ -2171,6 +2171,7 @@ export const OIDs = {
|
|
|
2171
2171
|
'2.16.840.1.114412.31.4.31.1': 'Digi Cert Grid Host Cert',
|
|
2172
2172
|
'2.16.840.1.114413.1.7.23.3': 'Go Daddy EV policy',
|
|
2173
2173
|
'2.16.840.1.114414.1.7.23.3': 'Starfield EV policy',
|
|
2174
|
+
'2.16.840.1.114569.1.1.3': 'SHAKEN/STIR Certificate Policy v1.3',
|
|
2174
2175
|
'2.23.42.0': 'Content Type',
|
|
2175
2176
|
'2.23.42.0.0': 'Pan Data',
|
|
2176
2177
|
'2.23.42.0.1': 'Pan Token',
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
// Constants.
|
|
3
|
+
const CERTIFICATE_EXAMPLE = `-----BEGIN CERTIFICATE-----
|
|
4
|
+
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
|
|
33
|
+
-----END CERTIFICATE-----`;
|
|
34
|
+
const CERTIFICATE_DECODER_ELEMENT = document.createElement('peculiar-certificate-decoder');
|
|
35
|
+
const HISTORY = window.HistoryLibrary.createBrowserHistory();
|
|
36
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
37
|
+
|
|
38
|
+
// Listeners.
|
|
39
|
+
CERTIFICATE_DECODER_ELEMENT.addEventListener('successParse', (event) => {
|
|
40
|
+
HISTORY.replace(`?cert=${encodeURIComponent(event.detail)}`);
|
|
41
|
+
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
window.scrollTo({
|
|
44
|
+
top: 460,
|
|
45
|
+
behavior: 'smooth',
|
|
46
|
+
});
|
|
47
|
+
}, 50);
|
|
48
|
+
});
|
|
49
|
+
CERTIFICATE_DECODER_ELEMENT.addEventListener('clearCertificate', () => {
|
|
50
|
+
HISTORY.replace('/');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Default props.
|
|
54
|
+
CERTIFICATE_DECODER_ELEMENT.certificateExample = CERTIFICATE_EXAMPLE;
|
|
55
|
+
|
|
56
|
+
if (searchParams.get('certurl')) {
|
|
57
|
+
window.fetch(searchParams.get('certurl'))
|
|
58
|
+
.then((body) => {
|
|
59
|
+
if (body.status >= 200 && body.status < 300) {
|
|
60
|
+
return body.text();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return Promise.reject();
|
|
64
|
+
})
|
|
65
|
+
.then((response) => {
|
|
66
|
+
CERTIFICATE_DECODER_ELEMENT.defaultCertificate = response;
|
|
67
|
+
})
|
|
68
|
+
.catch(() => {
|
|
69
|
+
alert('Failed to load certificate. Please use another file or check CORS policy.');
|
|
70
|
+
})
|
|
71
|
+
.finally(() => {
|
|
72
|
+
// Init.
|
|
73
|
+
content.appendChild(CERTIFICATE_DECODER_ELEMENT);
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
CERTIFICATE_DECODER_ELEMENT.defaultCertificate = searchParams.get('cert') || undefined;
|
|
77
|
+
// Init.
|
|
78
|
+
content.appendChild(CERTIFICATE_DECODER_ELEMENT);
|
|
79
|
+
}
|
|
80
|
+
})();
|