@peculiar/certificates-viewer 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{certification_request-878e786a.js → certification_request-cde57123.js} +137 -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-2f5bd471.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 -23
- package/dist/collection/components/certificate-viewer/attributes/type_relationship_attribute.js +1 -1
- package/dist/collection/components/certificate-viewer/extensions/basic_constraints_extension.js +1 -1
- package/dist/collection/components/certificate-viewer/extensions/basic_extension.js +1 -1
- package/dist/collection/components/certificate-viewer/extensions/timestamp_extension.js +1 -1
- package/dist/collection/utils/index.js +0 -1
- package/dist/collection/www-copy/index.js +80 -0
- package/dist/esm/{certification_request-3402a181.js → certification_request-c0674647.js} +76 -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-38c9ddc8.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-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-6011646e.entry.js +11 -0
- package/dist/peculiar/p-6bfd077c.entry.js +18 -0
- package/dist/peculiar/p-6c510523.js +18 -0
- package/dist/peculiar/p-986cc770.entry.js +11 -0
- package/dist/peculiar/p-b765873e.js +78 -0
- package/dist/peculiar/p-d7a13cb4.js +18 -0
- package/dist/peculiar/p-dafae164.entry.js +4 -0
- package/dist/peculiar/peculiar.esm.js +1 -1
- package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +13 -1
- package/dist/types/components.d.ts +20 -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 -2187
- 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 -2175
- package/dist/peculiar/p-08538084.entry.js +0 -113
- package/dist/peculiar/p-3fc37750.entry.js +0 -4
- package/dist/peculiar/p-8ad24aa3.js +0 -87
- package/dist/peculiar/p-99797a49.js +0 -34
- package/dist/peculiar/p-c774ec0b.js +0 -18
- 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
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import { b as build } from './
|
|
5
|
-
import
|
|
4
|
+
import { b as build } from './index-0ba131b0.js';
|
|
5
|
+
import './l10n-ac28fa92.js';
|
|
6
6
|
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-bfbd2ad8.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
/* eslint-disable no-useless-escape */
|
|
16
|
+
const isHex = (value) => (/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
|
|
17
|
+
.test(value));
|
|
18
|
+
const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/
|
|
19
|
+
.test(value));
|
|
20
|
+
const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
|
|
21
|
+
.test(value));
|
|
22
|
+
const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
|
|
23
|
+
.test(value));
|
|
24
|
+
const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
|
|
25
|
+
.test(value));
|
|
26
|
+
const isBase64 = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
window.atob(value);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
8
36
|
/*!
|
|
9
37
|
Copyright (c) Peculiar Ventures, LLC
|
|
10
38
|
*/
|
|
@@ -3270,51 +3298,51 @@ function verifySchema(inputBuffer, inputSchema) {
|
|
|
3270
3298
|
}
|
|
3271
3299
|
|
|
3272
3300
|
const asn1 = /*#__PURE__*/Object.freeze({
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3301
|
+
__proto__: null,
|
|
3302
|
+
Any: Any,
|
|
3303
|
+
BaseBlock: BaseBlock,
|
|
3304
|
+
BaseStringBlock: BaseStringBlock,
|
|
3305
|
+
BitString: BitString$1,
|
|
3306
|
+
BmpString: BmpString,
|
|
3307
|
+
Boolean: Boolean,
|
|
3308
|
+
CharacterString: CharacterString,
|
|
3309
|
+
Choice: Choice,
|
|
3310
|
+
Constructed: Constructed,
|
|
3311
|
+
DATE: DATE,
|
|
3312
|
+
DateTime: DateTime,
|
|
3313
|
+
Duration: Duration,
|
|
3314
|
+
EndOfContent: EndOfContent,
|
|
3315
|
+
Enumerated: Enumerated,
|
|
3316
|
+
GeneralString: GeneralString,
|
|
3317
|
+
GeneralizedTime: GeneralizedTime,
|
|
3318
|
+
GraphicString: GraphicString,
|
|
3319
|
+
HexBlock: HexBlock,
|
|
3320
|
+
IA5String: IA5String,
|
|
3321
|
+
Integer: Integer,
|
|
3322
|
+
Null: Null,
|
|
3323
|
+
NumericString: NumericString,
|
|
3324
|
+
ObjectIdentifier: ObjectIdentifier,
|
|
3325
|
+
OctetString: OctetString$1,
|
|
3326
|
+
Primitive: Primitive,
|
|
3327
|
+
PrintableString: PrintableString,
|
|
3328
|
+
RawData: RawData,
|
|
3329
|
+
RelativeObjectIdentifier: RelativeObjectIdentifier,
|
|
3330
|
+
Repeated: Repeated,
|
|
3331
|
+
Sequence: Sequence,
|
|
3332
|
+
Set: Set,
|
|
3333
|
+
TIME: TIME,
|
|
3334
|
+
TeletexString: TeletexString,
|
|
3335
|
+
TimeOfDay: TimeOfDay,
|
|
3336
|
+
UTCTime: UTCTime,
|
|
3337
|
+
UniversalString: UniversalString,
|
|
3338
|
+
Utf8String: Utf8String,
|
|
3339
|
+
ValueBlock: ValueBlock,
|
|
3340
|
+
VideotexString: VideotexString,
|
|
3341
|
+
ViewWriter: ViewWriter,
|
|
3342
|
+
VisibleString: VisibleString,
|
|
3343
|
+
compareSchema: compareSchema,
|
|
3344
|
+
fromBER: fromBER,
|
|
3345
|
+
verifySchema: verifySchema
|
|
3318
3346
|
});
|
|
3319
3347
|
|
|
3320
3348
|
var AsnTypeTypes;
|
|
@@ -6510,34 +6538,6 @@ __decorate([
|
|
|
6510
6538
|
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
|
|
6511
6539
|
], RSAPublicKey.prototype, "publicExponent", void 0);
|
|
6512
6540
|
|
|
6513
|
-
/**
|
|
6514
|
-
* @license
|
|
6515
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
6516
|
-
*
|
|
6517
|
-
* This source code is licensed under the MIT license found in the
|
|
6518
|
-
* LICENSE file in the root directory of this source tree.
|
|
6519
|
-
*/
|
|
6520
|
-
/* eslint-disable no-useless-escape */
|
|
6521
|
-
const isHex = (value) => (/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
|
|
6522
|
-
.test(value));
|
|
6523
|
-
const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/
|
|
6524
|
-
.test(value));
|
|
6525
|
-
const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
|
|
6526
|
-
.test(value));
|
|
6527
|
-
const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
|
|
6528
|
-
.test(value));
|
|
6529
|
-
const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
|
|
6530
|
-
.test(value));
|
|
6531
|
-
const isBase64 = (value) => {
|
|
6532
|
-
try {
|
|
6533
|
-
window.atob(value);
|
|
6534
|
-
return true;
|
|
6535
|
-
}
|
|
6536
|
-
catch (error) {
|
|
6537
|
-
return false;
|
|
6538
|
-
}
|
|
6539
|
-
};
|
|
6540
|
-
|
|
6541
6541
|
/**
|
|
6542
6542
|
* @license
|
|
6543
6543
|
* Copyright (c) Peculiar Ventures, LLC.
|
|
@@ -10229,135 +10229,6 @@ const getCertificateThumbprint = async (algorithm, data) => {
|
|
|
10229
10229
|
return undefined;
|
|
10230
10230
|
};
|
|
10231
10231
|
|
|
10232
|
-
/**
|
|
10233
|
-
* @license
|
|
10234
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
10235
|
-
*
|
|
10236
|
-
* This source code is licensed under the MIT license found in the
|
|
10237
|
-
* LICENSE file in the root directory of this source tree.
|
|
10238
|
-
*/
|
|
10239
|
-
class X509Certificate extends AsnData {
|
|
10240
|
-
constructor(raw) {
|
|
10241
|
-
super(certificateRawToBuffer(raw), Certificate);
|
|
10242
|
-
this.thumbprints = {};
|
|
10243
|
-
this.type = 'X.509 Certificate';
|
|
10244
|
-
const { tbsCertificate } = this.asn;
|
|
10245
|
-
this.serialNumber = build.Convert.ToHex(tbsCertificate.serialNumber);
|
|
10246
|
-
this.subject = new Name(tbsCertificate.subject).toJSON();
|
|
10247
|
-
this.issuer = new Name(tbsCertificate.issuer).toJSON();
|
|
10248
|
-
this.version = tbsCertificate.version + 1;
|
|
10249
|
-
const notBefore = tbsCertificate.validity.notBefore.utcTime
|
|
10250
|
-
|| tbsCertificate.validity.notBefore.generalTime;
|
|
10251
|
-
if (!notBefore) {
|
|
10252
|
-
throw new Error("Cannot get 'notBefore' value");
|
|
10253
|
-
}
|
|
10254
|
-
this.notBefore = notBefore;
|
|
10255
|
-
const notAfter = tbsCertificate.validity.notAfter.utcTime
|
|
10256
|
-
|| tbsCertificate.validity.notAfter.generalTime;
|
|
10257
|
-
if (!notAfter) {
|
|
10258
|
-
throw new Error("Cannot get 'notAfter' value");
|
|
10259
|
-
}
|
|
10260
|
-
this.notAfter = notAfter;
|
|
10261
|
-
this.validity = dateDiff(this.notBefore, this.notAfter);
|
|
10262
|
-
}
|
|
10263
|
-
parseExtensions() {
|
|
10264
|
-
const { tbsCertificate } = this.asn;
|
|
10265
|
-
if (tbsCertificate.extensions) {
|
|
10266
|
-
this.extensions = tbsCertificate.extensions
|
|
10267
|
-
.map((e) => new Extension(AsnConvert.serialize(e)));
|
|
10268
|
-
}
|
|
10269
|
-
}
|
|
10270
|
-
get publicKey() {
|
|
10271
|
-
const { subjectPublicKey, algorithm } = this.asn.tbsCertificate.subjectPublicKeyInfo;
|
|
10272
|
-
let params;
|
|
10273
|
-
if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {
|
|
10274
|
-
params = AsnConvert.parse(algorithm.parameters, ECParameters);
|
|
10275
|
-
}
|
|
10276
|
-
if (algorithm.algorithm === id_rsaEncryption) {
|
|
10277
|
-
params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);
|
|
10278
|
-
}
|
|
10279
|
-
const spki = AsnConvert.serialize(this.asn.tbsCertificate.subjectPublicKeyInfo);
|
|
10280
|
-
return {
|
|
10281
|
-
params,
|
|
10282
|
-
value: spki,
|
|
10283
|
-
algorithm: algorithm.algorithm,
|
|
10284
|
-
};
|
|
10285
|
-
}
|
|
10286
|
-
get signature() {
|
|
10287
|
-
const { signatureValue, signatureAlgorithm } = this.asn;
|
|
10288
|
-
return {
|
|
10289
|
-
value: signatureValue,
|
|
10290
|
-
algorithm: signatureAlgorithm.algorithm,
|
|
10291
|
-
};
|
|
10292
|
-
}
|
|
10293
|
-
exportAsBase64() {
|
|
10294
|
-
return build.Convert.ToBase64(this.raw);
|
|
10295
|
-
}
|
|
10296
|
-
exportAsHexFormatted() {
|
|
10297
|
-
return hexFormat(build.Convert.ToHex(this.raw));
|
|
10298
|
-
}
|
|
10299
|
-
exportAsPemFormatted() {
|
|
10300
|
-
return `-----BEGIN CERTIFICATE-----\n${base64Format(this.exportAsBase64())}\n-----END CERTIFICATE-----`;
|
|
10301
|
-
}
|
|
10302
|
-
async getThumbprint(algorithm = 'SHA-1') {
|
|
10303
|
-
try {
|
|
10304
|
-
const thumbprint = await getCertificateThumbprint(algorithm, this.raw);
|
|
10305
|
-
if (thumbprint) {
|
|
10306
|
-
this.thumbprints[algorithm['name'] || algorithm] = build.Convert.ToHex(thumbprint);
|
|
10307
|
-
}
|
|
10308
|
-
}
|
|
10309
|
-
catch (error) {
|
|
10310
|
-
console.error('Error thumbprint get:', error);
|
|
10311
|
-
}
|
|
10312
|
-
}
|
|
10313
|
-
get commonName() {
|
|
10314
|
-
if (!this.subject) {
|
|
10315
|
-
return '';
|
|
10316
|
-
}
|
|
10317
|
-
for (let i = 0; i < this.subject.length; i += 1) {
|
|
10318
|
-
const name = this.subject[i];
|
|
10319
|
-
if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {
|
|
10320
|
-
return name.value;
|
|
10321
|
-
}
|
|
10322
|
-
}
|
|
10323
|
-
return '';
|
|
10324
|
-
}
|
|
10325
|
-
get issuerCommonName() {
|
|
10326
|
-
if (!this.issuer) {
|
|
10327
|
-
return '';
|
|
10328
|
-
}
|
|
10329
|
-
for (let i = 0; i < this.issuer.length; i += 1) {
|
|
10330
|
-
const name = this.issuer[i];
|
|
10331
|
-
if (name.shortName === 'CN') {
|
|
10332
|
-
return name.value;
|
|
10333
|
-
}
|
|
10334
|
-
if (name.shortName === 'E') {
|
|
10335
|
-
return name.value;
|
|
10336
|
-
}
|
|
10337
|
-
}
|
|
10338
|
-
return '';
|
|
10339
|
-
}
|
|
10340
|
-
get isRoot() {
|
|
10341
|
-
return JSON.stringify(this.issuer) === JSON.stringify(this.subject);
|
|
10342
|
-
}
|
|
10343
|
-
subjectToString() {
|
|
10344
|
-
if (!this.subject) {
|
|
10345
|
-
return '';
|
|
10346
|
-
}
|
|
10347
|
-
return this.subject
|
|
10348
|
-
.map((name) => (`${name.shortName}=${name.value}`))
|
|
10349
|
-
.join(', ');
|
|
10350
|
-
}
|
|
10351
|
-
issuerToString() {
|
|
10352
|
-
if (!this.issuer) {
|
|
10353
|
-
return '';
|
|
10354
|
-
}
|
|
10355
|
-
return this.issuer
|
|
10356
|
-
.map((name) => (`${name.shortName}=${name.value}`))
|
|
10357
|
-
.join(', ');
|
|
10358
|
-
}
|
|
10359
|
-
}
|
|
10360
|
-
|
|
10361
10232
|
class ACClearAttrs {
|
|
10362
10233
|
constructor(params = {}) {
|
|
10363
10234
|
this.acIssuer = new GeneralName();
|
|
@@ -11635,4 +11506,4 @@ __decorate([
|
|
|
11635
11506
|
AsnProp({ type: AsnPropTypes.BitString })
|
|
11636
11507
|
], CertificationRequest.prototype, "signature", void 0);
|
|
11637
11508
|
|
|
11638
|
-
export {
|
|
11509
|
+
export { BasicConstraints as $, AsnData as A, id_DomainNameTechnicalOperator as B, Certificate as C, DomainNameTechnicalOperator as D, Extension as E, id_DomainNameOwner as F, DomainNameOwner as G, id_DomainNameLegalRepresentative as H, InsuranceValue as I, DomainNameLegalRepresentative as J, id_DomainNameBeneficiary as K, DomainNameBeneficiary as L, CertificationRequest as M, Name as N, OIDs as O, Name$1 as P, OtherName as Q, RSAPublicKey as R, DisplayText as S, TypeRelationship as T, UnstructuredName as U, ValuationRanking as V, WebGDPR as W, UserNotice as X, EDIPartyName as Y, AsnIntegerArrayBufferConverter as Z, KeyUsage as _, isX509Pem as a, ExtendedKeyUsage as a0, SubjectKeyIdentifier as a1, AuthorityKeyIdentifier as a2, CRLDistributionPoints as a3, AuthorityInfoAccessSyntax as a4, SubjectInfoAccessSyntax as a5, SubjectAlternativeName as a6, CertificatePolicies as a7, CertificateTransparency as a8, NameConstraints as a9, CertificateTemplate as aa, EnrollCertTypeChoice as ab, CaVersion as ac, QCStatements as ad, NetscapeComment as ae, NetscapeCertType as af, LeiRole as ag, LeiChoice as ah, Timestamp as ai, ArchiveRevInfo as aj, CRLReason as ak, SubjectDirectoryAttributes as al, PrivateKeyUsagePeriod as am, EntrustVersionInfo as an, BiometricSyntax as ao, LogotypeExtn as ap, TNAuthorizationList as aq, PolicyConstraints as ar, PolicyMappings as as, isPkcs10Pem as b, isX509AttributePem as c, certificateRawToBuffer as d, AsnConvert as e, id_ecPublicKey as f, ECParameters as g, id_rsaEncryption as h, isPem as i, hexFormat as j, base64Format as k, getCertificateThumbprint as l, AttributeCertificate as m, Attribute$1 as n, id_pkcs9_at_extensionRequest as o, AsnParser as p, ExtensionRequest as q, id_pkcs9_at_unstructuredName as r, id_pkcs9_at_challengePassword as s, ChallengePassword as t, id_ValuationRanking as u, id_InsuranceValue as v, id_WebGDPR as w, id_ActivityDescription as x, ActivityDescription as y, id_TypeRelationship as z };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { A as AsnData, n as Attribute$1, o as id_pkcs9_at_extensionRequest, p as AsnParser, q as ExtensionRequest, E as Extension, e as AsnConvert, r as id_pkcs9_at_unstructuredName, U as UnstructuredName, s as id_pkcs9_at_challengePassword, t as ChallengePassword, u as id_ValuationRanking, V as ValuationRanking, v as id_InsuranceValue, I as InsuranceValue, w as id_WebGDPR, W as WebGDPR, x as id_ActivityDescription, y as ActivityDescription, z as id_TypeRelationship, T as TypeRelationship, B as id_DomainNameTechnicalOperator, D as DomainNameTechnicalOperator, F as id_DomainNameOwner, G as DomainNameOwner, H as id_DomainNameLegalRepresentative, J as DomainNameLegalRepresentative, K as id_DomainNameBeneficiary, L as DomainNameBeneficiary, d as certificateRawToBuffer, M as CertificationRequest, N as Name, f as id_ecPublicKey, g as ECParameters, h as id_rsaEncryption, R as RSAPublicKey, l as getCertificateThumbprint, j as hexFormat, k as base64Format } from './certification_request-c0674647.js';
|
|
5
|
+
import { b as build } from './index-0ba131b0.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
class Attribute extends AsnData {
|
|
15
|
+
constructor(raw) {
|
|
16
|
+
super(raw, Attribute$1);
|
|
17
|
+
const asnExtnValue = this.getAsnExtnValue();
|
|
18
|
+
switch (this.asn.type) {
|
|
19
|
+
case id_DomainNameBeneficiary:
|
|
20
|
+
this.value = AsnParser.parse(asnExtnValue, DomainNameBeneficiary);
|
|
21
|
+
break;
|
|
22
|
+
case id_DomainNameLegalRepresentative:
|
|
23
|
+
this.value = AsnParser.parse(asnExtnValue, DomainNameLegalRepresentative);
|
|
24
|
+
break;
|
|
25
|
+
case id_DomainNameOwner:
|
|
26
|
+
this.value = AsnParser.parse(asnExtnValue, DomainNameOwner);
|
|
27
|
+
break;
|
|
28
|
+
case id_DomainNameTechnicalOperator:
|
|
29
|
+
this.value = AsnParser.parse(asnExtnValue, DomainNameTechnicalOperator);
|
|
30
|
+
break;
|
|
31
|
+
case id_TypeRelationship:
|
|
32
|
+
this.value = AsnParser.parse(asnExtnValue, TypeRelationship);
|
|
33
|
+
break;
|
|
34
|
+
case id_ActivityDescription:
|
|
35
|
+
this.value = AsnParser.parse(asnExtnValue, ActivityDescription);
|
|
36
|
+
break;
|
|
37
|
+
case id_WebGDPR:
|
|
38
|
+
this.value = AsnParser.parse(asnExtnValue, WebGDPR);
|
|
39
|
+
break;
|
|
40
|
+
case id_InsuranceValue:
|
|
41
|
+
this.value = AsnParser.parse(asnExtnValue, InsuranceValue);
|
|
42
|
+
break;
|
|
43
|
+
case id_ValuationRanking:
|
|
44
|
+
this.value = AsnParser.parse(asnExtnValue, ValuationRanking);
|
|
45
|
+
break;
|
|
46
|
+
case id_pkcs9_at_challengePassword:
|
|
47
|
+
this.value = AsnParser.parse(asnExtnValue, ChallengePassword);
|
|
48
|
+
break;
|
|
49
|
+
case id_pkcs9_at_unstructuredName:
|
|
50
|
+
this.value = AsnParser.parse(asnExtnValue, UnstructuredName);
|
|
51
|
+
break;
|
|
52
|
+
case id_pkcs9_at_extensionRequest: {
|
|
53
|
+
const extensionRequest = AsnParser.parse(asnExtnValue, ExtensionRequest);
|
|
54
|
+
this.value = extensionRequest
|
|
55
|
+
.map((e) => new Extension(AsnConvert.serialize(e)));
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
default:
|
|
59
|
+
this.value = build.Convert.ToHex(asnExtnValue);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getAsnExtnValue() {
|
|
63
|
+
return this.asn.values[0];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @license
|
|
69
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the MIT license found in the
|
|
72
|
+
* LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/
|
|
74
|
+
class CSR extends AsnData {
|
|
75
|
+
constructor(raw) {
|
|
76
|
+
super(certificateRawToBuffer(raw), CertificationRequest);
|
|
77
|
+
this.thumbprints = {};
|
|
78
|
+
this.type = 'PKCS#10 Certificate Request';
|
|
79
|
+
const { certificationRequestInfo } = this.asn;
|
|
80
|
+
this.subject = new Name(certificationRequestInfo.subject).toJSON();
|
|
81
|
+
this.version = certificationRequestInfo.version;
|
|
82
|
+
}
|
|
83
|
+
get publicKey() {
|
|
84
|
+
const { subjectPublicKey, algorithm } = this.asn.certificationRequestInfo.subjectPKInfo;
|
|
85
|
+
let params;
|
|
86
|
+
if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {
|
|
87
|
+
params = AsnConvert.parse(algorithm.parameters, ECParameters);
|
|
88
|
+
}
|
|
89
|
+
if (algorithm.algorithm === id_rsaEncryption) {
|
|
90
|
+
params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);
|
|
91
|
+
}
|
|
92
|
+
const spki = AsnConvert.serialize(this.asn.certificationRequestInfo.subjectPKInfo);
|
|
93
|
+
return {
|
|
94
|
+
params,
|
|
95
|
+
value: spki,
|
|
96
|
+
algorithm: algorithm.algorithm,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
get signature() {
|
|
100
|
+
const { signature, signatureAlgorithm } = this.asn;
|
|
101
|
+
return {
|
|
102
|
+
value: signature,
|
|
103
|
+
algorithm: signatureAlgorithm.algorithm,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
get commonName() {
|
|
107
|
+
if (!this.subject) {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
110
|
+
for (let i = 0; i < this.subject.length; i += 1) {
|
|
111
|
+
const name = this.subject[i];
|
|
112
|
+
if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {
|
|
113
|
+
return name.value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
async getThumbprint(algorithm = 'SHA-1') {
|
|
119
|
+
try {
|
|
120
|
+
const thumbprint = await getCertificateThumbprint(algorithm, this.raw);
|
|
121
|
+
if (thumbprint) {
|
|
122
|
+
this.thumbprints[algorithm['name'] || algorithm] = build.Convert.ToHex(thumbprint);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error('Error thumbprint get:', error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
parseAttributes() {
|
|
130
|
+
const { certificationRequestInfo } = this.asn;
|
|
131
|
+
if (certificationRequestInfo.attributes) {
|
|
132
|
+
this.attributes = certificationRequestInfo.attributes
|
|
133
|
+
.map((e) => new Attribute(AsnConvert.serialize(e)));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exportAsBase64() {
|
|
137
|
+
return build.Convert.ToBase64(this.raw);
|
|
138
|
+
}
|
|
139
|
+
exportAsHexFormatted() {
|
|
140
|
+
return hexFormat(build.Convert.ToHex(this.raw));
|
|
141
|
+
}
|
|
142
|
+
exportAsPemFormatted() {
|
|
143
|
+
return `-----BEGIN CERTIFICATE REQUEST-----\n${base64Format(this.exportAsBase64())}\n-----END CERTIFICATE REQUEST-----`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { Attribute as A, CSR as C };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { b as build } from './index-0ba131b0.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @license
|
|
8
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Download from buffer
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```js
|
|
18
|
+
* import { downloadFromBuffer } from './utils';
|
|
19
|
+
*
|
|
20
|
+
* downloadFromBuffer(arrayBufferValue, 'myFile', 'pdf', 'applciation/pdf');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function downloadFromBuffer(value, name, extension, mime = 'application/octet-stream') {
|
|
24
|
+
const blob = new Blob([value], { type: mime });
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL)
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
navigator.msSaveBlob(blob, `${name}.${extension}`);
|
|
29
|
+
return new Promise((res) => setTimeout(res, 100));
|
|
30
|
+
}
|
|
31
|
+
const blobURL = window.URL.createObjectURL(blob);
|
|
32
|
+
const link = document.createElement('a');
|
|
33
|
+
const frame = document.createElement('iframe');
|
|
34
|
+
link.style.display = 'none';
|
|
35
|
+
frame.style.display = 'none';
|
|
36
|
+
frame.name = blobURL;
|
|
37
|
+
document.body.appendChild(frame);
|
|
38
|
+
link.href = blobURL;
|
|
39
|
+
link.target = blobURL;
|
|
40
|
+
link.download = `${name}.${extension}`;
|
|
41
|
+
document.body.appendChild(link);
|
|
42
|
+
link.dispatchEvent(new MouseEvent('click'));
|
|
43
|
+
document.body.removeChild(link);
|
|
44
|
+
return new Promise((res) => setTimeout(() => {
|
|
45
|
+
document.body.removeChild(frame);
|
|
46
|
+
res(undefined);
|
|
47
|
+
}, 100));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/
|
|
57
|
+
class Download {
|
|
58
|
+
}
|
|
59
|
+
Download.x509 = {
|
|
60
|
+
asPEM: (pem, name) => {
|
|
61
|
+
downloadFromBuffer(build.Convert.FromString(pem), name, 'cer', 'application/pkix-cert');
|
|
62
|
+
},
|
|
63
|
+
asDER: (hex, name) => {
|
|
64
|
+
downloadFromBuffer(build.Convert.FromString(hex), name, 'cer', 'application/pkix-cert');
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
Download.pkcs10 = {
|
|
68
|
+
asPEM: (pem, name) => {
|
|
69
|
+
downloadFromBuffer(build.Convert.FromString(pem), name, 'csr', 'application/pkcs10');
|
|
70
|
+
},
|
|
71
|
+
asDER: (hex, name) => {
|
|
72
|
+
downloadFromBuffer(build.Convert.FromString(hex), name, 'csr', 'application/pkcs10');
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { Download as D, downloadFromBuffer as d };
|
|
@@ -3,50 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { c as createCommonjsModule } from './_commonjsHelpers-bfbd2ad8.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @license
|
|
8
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Download from buffer
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```js
|
|
18
|
-
* import { downloadFromBuffer } from './utils';
|
|
19
|
-
*
|
|
20
|
-
* downloadFromBuffer(arrayBufferValue, 'myFile', 'pdf', 'applciation/pdf');
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function downloadFromBuffer(value, name, extension, mime = 'application/octet-stream') {
|
|
24
|
-
const blob = new Blob([value], { type: mime });
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL)
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
navigator.msSaveBlob(blob, `${name}.${extension}`);
|
|
29
|
-
return new Promise((res) => setTimeout(res, 100));
|
|
30
|
-
}
|
|
31
|
-
const blobURL = window.URL.createObjectURL(blob);
|
|
32
|
-
const link = document.createElement('a');
|
|
33
|
-
const frame = document.createElement('iframe');
|
|
34
|
-
link.style.display = 'none';
|
|
35
|
-
frame.style.display = 'none';
|
|
36
|
-
frame.name = blobURL;
|
|
37
|
-
document.body.appendChild(frame);
|
|
38
|
-
link.href = blobURL;
|
|
39
|
-
link.target = blobURL;
|
|
40
|
-
link.download = `${name}.${extension}`;
|
|
41
|
-
document.body.appendChild(link);
|
|
42
|
-
link.dispatchEvent(new MouseEvent('click'));
|
|
43
|
-
document.body.removeChild(link);
|
|
44
|
-
return new Promise((res) => setTimeout(() => {
|
|
45
|
-
document.body.removeChild(frame);
|
|
46
|
-
res(undefined);
|
|
47
|
-
}, 100));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
6
|
var build = createCommonjsModule(function (module, exports) {
|
|
51
7
|
|
|
52
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -405,30 +361,4 @@ exports.combine = combine;
|
|
|
405
361
|
exports.isEqual = isEqual;
|
|
406
362
|
});
|
|
407
363
|
|
|
408
|
-
|
|
409
|
-
* @license
|
|
410
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
411
|
-
*
|
|
412
|
-
* This source code is licensed under the MIT license found in the
|
|
413
|
-
* LICENSE file in the root directory of this source tree.
|
|
414
|
-
*/
|
|
415
|
-
class Download {
|
|
416
|
-
}
|
|
417
|
-
Download.x509 = {
|
|
418
|
-
asPEM: (pem, name) => {
|
|
419
|
-
downloadFromBuffer(build.Convert.FromString(pem), name, 'cer', 'application/pkix-cert');
|
|
420
|
-
},
|
|
421
|
-
asDER: (hex, name) => {
|
|
422
|
-
downloadFromBuffer(build.Convert.FromString(hex), name, 'cer', 'application/pkix-cert');
|
|
423
|
-
},
|
|
424
|
-
};
|
|
425
|
-
Download.pkcs10 = {
|
|
426
|
-
asPEM: (pem, name) => {
|
|
427
|
-
downloadFromBuffer(build.Convert.FromString(pem), name, 'csr', 'application/pkcs10');
|
|
428
|
-
},
|
|
429
|
-
asDER: (hex, name) => {
|
|
430
|
-
downloadFromBuffer(build.Convert.FromString(hex), name, 'csr', 'application/pkcs10');
|
|
431
|
-
},
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
export { Download as D, build as b, downloadFromBuffer as d };
|
|
364
|
+
export { build as b };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
|
|
3
3
|
*/
|
|
4
|
-
export { D as Download, d as downloadFromBuffer } from './download-
|
|
4
|
+
export { D as Download, d as downloadFromBuffer } from './download-735fb2eb.js';
|
|
5
|
+
import './index-0ba131b0.js';
|
|
5
6
|
import './_commonjsHelpers-bfbd2ad8.js';
|