@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.
Files changed (76) 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-2f5bd471.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/components/certificate-viewer/attributes/type_relationship_attribute.js +1 -1
  20. package/dist/collection/components/certificate-viewer/extensions/basic_constraints_extension.js +1 -1
  21. package/dist/collection/components/certificate-viewer/extensions/basic_extension.js +1 -1
  22. package/dist/collection/components/certificate-viewer/extensions/timestamp_extension.js +1 -1
  23. package/dist/collection/utils/index.js +0 -1
  24. package/dist/collection/www-copy/index.js +80 -0
  25. package/dist/esm/{certification_request-3402a181.js → certification_request-c0674647.js} +76 -205
  26. package/dist/esm/csr-c1b6a176.js +147 -0
  27. package/dist/esm/download-735fb2eb.js +76 -0
  28. package/dist/esm/{download-cf68ac2c.js → index-0ba131b0.js} +1 -71
  29. package/dist/esm/index.js +2 -1
  30. package/dist/esm/l10n-ac28fa92.js +141 -0
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/peculiar-attribute-certificate-viewer_2.entry.js +474 -0
  33. package/dist/esm/peculiar-button_5.entry.js +140 -0
  34. package/dist/esm/peculiar-certificate-decoder.entry.js +169 -0
  35. package/dist/esm/peculiar-certificate-summary_3.entry.js +1 -1
  36. package/dist/esm/peculiar-certificate-viewer.entry.js +120 -0
  37. package/dist/esm/peculiar-certificates-viewer.entry.js +5 -3
  38. package/dist/esm/peculiar.js +1 -1
  39. package/dist/esm/public_key-38c9ddc8.js +1089 -0
  40. package/dist/esm/x509_attribute_certificate-a6d4aa15.js +85 -0
  41. package/dist/esm/x509_certificate-12f6d344.js +137 -0
  42. package/dist/peculiar/index.esm.js +1 -1
  43. package/dist/peculiar/p-006865d7.js +4 -0
  44. package/dist/peculiar/p-17c4da7b.js +11 -0
  45. package/dist/peculiar/{p-b09a1f0b.entry.js → p-38635919.entry.js} +1 -1
  46. package/dist/peculiar/p-3f8d1008.entry.js +4 -0
  47. package/dist/peculiar/p-42da7f97.js +11 -0
  48. package/dist/peculiar/p-464e0943.js +87 -0
  49. package/dist/peculiar/p-4f4c1d30.js +12 -0
  50. package/dist/peculiar/p-6011646e.entry.js +11 -0
  51. package/dist/peculiar/p-6bfd077c.entry.js +18 -0
  52. package/dist/peculiar/p-6c510523.js +18 -0
  53. package/dist/peculiar/p-986cc770.entry.js +11 -0
  54. package/dist/peculiar/p-b765873e.js +78 -0
  55. package/dist/peculiar/p-d7a13cb4.js +18 -0
  56. package/dist/peculiar/p-dafae164.entry.js +4 -0
  57. package/dist/peculiar/peculiar.esm.js +1 -1
  58. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +13 -1
  59. package/dist/types/components.d.ts +20 -0
  60. package/dist/types/utils/index.d.ts +0 -1
  61. package/package.json +2 -3
  62. package/dist/cjs/l10n-d4a77087.js +0 -767
  63. package/dist/cjs/peculiar-attribute-certificate-viewer_9.cjs.entry.js +0 -2187
  64. package/dist/collection/utils/history.js +0 -19
  65. package/dist/collection/utils/parse_hash.js +0 -28
  66. package/dist/collection/utils/query_stringify.js +0 -21
  67. package/dist/esm/l10n-9ac63748.js +0 -762
  68. package/dist/esm/peculiar-attribute-certificate-viewer_9.entry.js +0 -2175
  69. package/dist/peculiar/p-08538084.entry.js +0 -113
  70. package/dist/peculiar/p-3fc37750.entry.js +0 -4
  71. package/dist/peculiar/p-8ad24aa3.js +0 -87
  72. package/dist/peculiar/p-99797a49.js +0 -34
  73. package/dist/peculiar/p-c774ec0b.js +0 -18
  74. package/dist/types/utils/history.d.ts +0 -9
  75. package/dist/types/utils/parse_hash.d.ts +0 -9
  76. package/dist/types/utils/query_stringify.d.ts +0 -8
@@ -3,10 +3,38 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const download = require('./download-5e7d5455.js');
7
- const l10n = require('./l10n-d4a77087.js');
6
+ const index = require('./index-ff818d4d.js');
7
+ require('./l10n-a048a686.js');
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-cb1f949a.js');
9
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
+ /* eslint-disable no-useless-escape */
18
+ const isHex = (value) => (/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
19
+ .test(value));
20
+ const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/
21
+ .test(value));
22
+ const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
23
+ .test(value));
24
+ const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
25
+ .test(value));
26
+ const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
27
+ .test(value));
28
+ const isBase64 = (value) => {
29
+ try {
30
+ window.atob(value);
31
+ return true;
32
+ }
33
+ catch (error) {
34
+ return false;
35
+ }
36
+ };
37
+
10
38
  /*!
11
39
  Copyright (c) Peculiar Ventures, LLC
12
40
  */
@@ -264,7 +292,7 @@ function HexBlock(BaseClass) {
264
292
  super(...args);
265
293
  const params = args[0] || {};
266
294
  this.isHexOnly = (_a = params.isHexOnly) !== null && _a !== void 0 ? _a : false;
267
- this.valueHexView = params.valueHex ? download.build.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
295
+ this.valueHexView = params.valueHex ? index.build.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
268
296
  }
269
297
  get valueHex() {
270
298
  return this.valueHexView.slice().buffer;
@@ -302,7 +330,7 @@ function HexBlock(BaseClass) {
302
330
  return {
303
331
  ...super.toJSON(),
304
332
  isHexOnly: this.isHexOnly,
305
- valueHex: download.build.Convert.ToHex(this.valueHexView),
333
+ valueHex: index.build.Convert.ToHex(this.valueHexView),
306
334
  };
307
335
  }
308
336
  },
@@ -315,7 +343,7 @@ class LocalBaseBlock {
315
343
  this.blockLength = blockLength;
316
344
  this.error = error;
317
345
  this.warnings = warnings;
318
- this.valueBeforeDecodeView = download.build.BufferSourceConverter.toUint8Array(valueBeforeDecode);
346
+ this.valueBeforeDecodeView = index.build.BufferSourceConverter.toUint8Array(valueBeforeDecode);
319
347
  }
320
348
  static blockName() {
321
349
  return this.NAME;
@@ -332,7 +360,7 @@ class LocalBaseBlock {
332
360
  blockLength: this.blockLength,
333
361
  error: this.error,
334
362
  warnings: this.warnings,
335
- valueBeforeDecode: download.build.Convert.ToHex(this.valueBeforeDecodeView),
363
+ valueBeforeDecode: index.build.Convert.ToHex(this.valueBeforeDecodeView),
336
364
  };
337
365
  }
338
366
  }
@@ -354,7 +382,7 @@ class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {
354
382
  super();
355
383
  if (idBlock) {
356
384
  this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false;
357
- this.valueHexView = idBlock.valueHex ? download.build.BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;
385
+ this.valueHexView = idBlock.valueHex ? index.build.BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;
358
386
  this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1;
359
387
  this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1;
360
388
  this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false;
@@ -420,7 +448,7 @@ class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {
420
448
  return retView.buffer;
421
449
  }
422
450
  fromBER(inputBuffer, inputOffset, inputLength) {
423
- const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
451
+ const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
424
452
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
425
453
  return -1;
426
454
  }
@@ -529,7 +557,7 @@ class LocalLengthBlock extends LocalBaseBlock {
529
557
  this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0;
530
558
  }
531
559
  fromBER(inputBuffer, inputOffset, inputLength) {
532
- const view = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
560
+ const view = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
533
561
  if (!checkBufferParams(this, view, inputOffset, inputLength)) {
534
562
  return -1;
535
563
  }
@@ -688,10 +716,10 @@ class BaseBlock extends LocalBaseBlock {
688
716
  if (encoding === "ascii") {
689
717
  return this.onAsciiEncoding();
690
718
  }
691
- return download.build.Convert.ToHex(this.toBER());
719
+ return index.build.Convert.ToHex(this.toBER());
692
720
  }
693
721
  onAsciiEncoding() {
694
- return `${this.constructor.NAME} : ${download.build.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;
722
+ return `${this.constructor.NAME} : ${index.build.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;
695
723
  }
696
724
  isEqual(other) {
697
725
  if (this === other) {
@@ -989,7 +1017,7 @@ function fromBER(inputBuffer) {
989
1017
  result
990
1018
  };
991
1019
  }
992
- return localFromBER(download.build.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);
1020
+ return localFromBER(index.build.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);
993
1021
  }
994
1022
 
995
1023
  function checkLen(indefiniteLength, length) {
@@ -1005,7 +1033,7 @@ class LocalConstructedValueBlock extends ValueBlock {
1005
1033
  this.isIndefiniteForm = isIndefiniteForm;
1006
1034
  }
1007
1035
  fromBER(inputBuffer, inputOffset, inputLength) {
1008
- const view = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1036
+ const view = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1009
1037
  if (!checkBufferParams(this, view, inputOffset, inputLength)) {
1010
1038
  return -1;
1011
1039
  }
@@ -1175,7 +1203,7 @@ class LocalBooleanValueBlock extends HexBlock(ValueBlock) {
1175
1203
  constructor({ value, ...parameters } = {}) {
1176
1204
  super(parameters);
1177
1205
  if (parameters.valueHex) {
1178
- this.valueHexView = download.build.BufferSourceConverter.toUint8Array(parameters.valueHex);
1206
+ this.valueHexView = index.build.BufferSourceConverter.toUint8Array(parameters.valueHex);
1179
1207
  }
1180
1208
  else {
1181
1209
  this.valueHexView = new Uint8Array(1);
@@ -1196,7 +1224,7 @@ class LocalBooleanValueBlock extends HexBlock(ValueBlock) {
1196
1224
  this.valueHexView[0] = value ? 0xFF : 0x00;
1197
1225
  }
1198
1226
  fromBER(inputBuffer, inputOffset, inputLength) {
1199
- const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1227
+ const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1200
1228
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1201
1229
  return -1;
1202
1230
  }
@@ -1343,7 +1371,7 @@ class OctetString$1 extends BaseBlock {
1343
1371
  if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {
1344
1372
  return Constructed.prototype.onAsciiEncoding.call(this);
1345
1373
  }
1346
- return `${this.constructor.NAME} : ${download.build.Convert.ToHex(this.valueBlock.valueHexView)}`;
1374
+ return `${this.constructor.NAME} : ${index.build.Convert.ToHex(this.valueBlock.valueHexView)}`;
1347
1375
  }
1348
1376
  getValue() {
1349
1377
  if (!this.idBlock.isConstructed) {
@@ -1355,7 +1383,7 @@ class OctetString$1 extends BaseBlock {
1355
1383
  array.push(content.valueBlock.valueHexView);
1356
1384
  }
1357
1385
  }
1358
- return download.build.BufferSourceConverter.concat(array);
1386
+ return index.build.BufferSourceConverter.concat(array);
1359
1387
  }
1360
1388
  }
1361
1389
  _a$r = OctetString$1;
@@ -1403,7 +1431,7 @@ class LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) {
1403
1431
  }
1404
1432
  return resultOffset;
1405
1433
  }
1406
- const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1434
+ const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1407
1435
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1408
1436
  return -1;
1409
1437
  }
@@ -1743,13 +1771,13 @@ class Integer extends BaseBlock {
1743
1771
  const bigIntValue = BigInt(value);
1744
1772
  const writer = new ViewWriter();
1745
1773
  const hex = bigIntValue.toString(16).replace(/^-/, "");
1746
- const view = new Uint8Array(download.build.Convert.FromHex(hex));
1774
+ const view = new Uint8Array(index.build.Convert.FromHex(hex));
1747
1775
  if (bigIntValue < 0) {
1748
1776
  const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0));
1749
1777
  first[0] |= 0x80;
1750
- const firstInt = BigInt(`0x${download.build.Convert.ToHex(first)}`);
1778
+ const firstInt = BigInt(`0x${index.build.Convert.ToHex(first)}`);
1751
1779
  const secondInt = firstInt + bigIntValue;
1752
- const second = download.build.BufferSourceConverter.toUint8Array(download.build.Convert.FromHex(secondInt.toString(16)));
1780
+ const second = index.build.BufferSourceConverter.toUint8Array(index.build.Convert.FromHex(secondInt.toString(16)));
1753
1781
  second[0] |= 0x80;
1754
1782
  writer.write(second);
1755
1783
  }
@@ -1810,7 +1838,7 @@ class LocalSidValueBlock extends HexBlock(ValueBlock) {
1810
1838
  if (!inputLength) {
1811
1839
  return inputOffset;
1812
1840
  }
1813
- const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1841
+ const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1814
1842
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1815
1843
  return -1;
1816
1844
  }
@@ -1882,7 +1910,7 @@ class LocalSidValueBlock extends HexBlock(ValueBlock) {
1882
1910
  toString() {
1883
1911
  let result = "";
1884
1912
  if (this.isHexOnly)
1885
- result = download.build.Convert.ToHex(this.valueHexView);
1913
+ result = index.build.Convert.ToHex(this.valueHexView);
1886
1914
  else {
1887
1915
  if (this.isFirstSid) {
1888
1916
  let sidValue = this.valueDec;
@@ -2079,7 +2107,7 @@ class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {
2079
2107
  fromBER(inputBuffer, inputOffset, inputLength) {
2080
2108
  if (inputLength === 0)
2081
2109
  return inputOffset;
2082
- const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2110
+ const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2083
2111
  if (!checkBufferParams(this, inputView, inputOffset, inputLength))
2084
2112
  return -1;
2085
2113
  const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);
@@ -2137,7 +2165,7 @@ class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {
2137
2165
  toString() {
2138
2166
  let result = "";
2139
2167
  if (this.isHexOnly)
2140
- result = download.build.Convert.ToHex(this.valueHexView);
2168
+ result = index.build.Convert.ToHex(this.valueHexView);
2141
2169
  else {
2142
2170
  result = this.valueDec.toString();
2143
2171
  }
@@ -2319,7 +2347,7 @@ class LocalSimpleStringBlock extends BaseStringBlock {
2319
2347
  super(parameters, LocalSimpleStringValueBlock);
2320
2348
  }
2321
2349
  fromBuffer(inputBuffer) {
2322
- this.valueBlock.value = String.fromCharCode.apply(null, download.build.BufferSourceConverter.toUint8Array(inputBuffer));
2350
+ this.valueBlock.value = String.fromCharCode.apply(null, index.build.BufferSourceConverter.toUint8Array(inputBuffer));
2323
2351
  }
2324
2352
  fromString(inputString) {
2325
2353
  const strLen = inputString.length;
@@ -2333,17 +2361,17 @@ LocalSimpleStringBlock.NAME = "SIMPLE STRING";
2333
2361
 
2334
2362
  class LocalUtf8StringValueBlock extends LocalSimpleStringBlock {
2335
2363
  fromBuffer(inputBuffer) {
2336
- this.valueBlock.valueHexView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2364
+ this.valueBlock.valueHexView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2337
2365
  try {
2338
- this.valueBlock.value = download.build.Convert.ToUtf8String(inputBuffer);
2366
+ this.valueBlock.value = index.build.Convert.ToUtf8String(inputBuffer);
2339
2367
  }
2340
2368
  catch (ex) {
2341
2369
  this.warnings.push(`Error during "decodeURIComponent": ${ex}, using raw string`);
2342
- this.valueBlock.value = download.build.Convert.ToBinary(inputBuffer);
2370
+ this.valueBlock.value = index.build.Convert.ToBinary(inputBuffer);
2343
2371
  }
2344
2372
  }
2345
2373
  fromString(inputString) {
2346
- this.valueBlock.valueHexView = new Uint8Array(download.build.Convert.FromUtf8String(inputString));
2374
+ this.valueBlock.valueHexView = new Uint8Array(index.build.Convert.FromUtf8String(inputString));
2347
2375
  this.valueBlock.value = inputString;
2348
2376
  }
2349
2377
  }
@@ -2365,12 +2393,12 @@ Utf8String.NAME = "UTF8String";
2365
2393
 
2366
2394
  class LocalBmpStringValueBlock extends LocalSimpleStringBlock {
2367
2395
  fromBuffer(inputBuffer) {
2368
- this.valueBlock.value = download.build.Convert.ToUtf16String(inputBuffer);
2369
- this.valueBlock.valueHexView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2396
+ this.valueBlock.value = index.build.Convert.ToUtf16String(inputBuffer);
2397
+ this.valueBlock.valueHexView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2370
2398
  }
2371
2399
  fromString(inputString) {
2372
2400
  this.valueBlock.value = inputString;
2373
- this.valueBlock.valueHexView = new Uint8Array(download.build.Convert.FromUtf16String(inputString));
2401
+ this.valueBlock.valueHexView = new Uint8Array(index.build.Convert.FromUtf16String(inputString));
2374
2402
  }
2375
2403
  }
2376
2404
  LocalBmpStringValueBlock.NAME = "BmpStringValueBlock";
@@ -2582,7 +2610,7 @@ class UTCTime extends VisibleString {
2582
2610
  this.idBlock.tagNumber = 23;
2583
2611
  }
2584
2612
  fromBuffer(inputBuffer) {
2585
- this.fromString(String.fromCharCode.apply(null, download.build.BufferSourceConverter.toUint8Array(inputBuffer)));
2613
+ this.fromString(String.fromCharCode.apply(null, index.build.BufferSourceConverter.toUint8Array(inputBuffer)));
2586
2614
  }
2587
2615
  toBuffer() {
2588
2616
  const str = this.toString();
@@ -2932,17 +2960,17 @@ class Repeated extends Any {
2932
2960
 
2933
2961
  class RawData {
2934
2962
  constructor({ data = EMPTY_VIEW } = {}) {
2935
- this.dataView = download.build.BufferSourceConverter.toUint8Array(data);
2963
+ this.dataView = index.build.BufferSourceConverter.toUint8Array(data);
2936
2964
  }
2937
2965
  get data() {
2938
2966
  return this.dataView.slice().buffer;
2939
2967
  }
2940
2968
  set data(value) {
2941
- this.dataView = download.build.BufferSourceConverter.toUint8Array(value);
2969
+ this.dataView = index.build.BufferSourceConverter.toUint8Array(value);
2942
2970
  }
2943
2971
  fromBER(inputBuffer, inputOffset, inputLength) {
2944
2972
  const endLength = inputOffset + inputLength;
2945
- this.dataView = download.build.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);
2973
+ this.dataView = index.build.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);
2946
2974
  return endLength;
2947
2975
  }
2948
2976
  toBER(sizeOnly) {
@@ -3261,7 +3289,7 @@ function verifySchema(inputBuffer, inputSchema) {
3261
3289
  result: { error: "Wrong ASN.1 schema type" }
3262
3290
  };
3263
3291
  }
3264
- const asn1 = localFromBER(download.build.BufferSourceConverter.toUint8Array(inputBuffer));
3292
+ const asn1 = localFromBER(index.build.BufferSourceConverter.toUint8Array(inputBuffer));
3265
3293
  if (asn1.offset === -1) {
3266
3294
  return {
3267
3295
  verified: false,
@@ -3272,51 +3300,51 @@ function verifySchema(inputBuffer, inputSchema) {
3272
3300
  }
3273
3301
 
3274
3302
  const asn1 = /*#__PURE__*/Object.freeze({
3275
- __proto__: null,
3276
- Any: Any,
3277
- BaseBlock: BaseBlock,
3278
- BaseStringBlock: BaseStringBlock,
3279
- BitString: BitString$1,
3280
- BmpString: BmpString,
3281
- Boolean: Boolean,
3282
- CharacterString: CharacterString,
3283
- Choice: Choice,
3284
- Constructed: Constructed,
3285
- DATE: DATE,
3286
- DateTime: DateTime,
3287
- Duration: Duration,
3288
- EndOfContent: EndOfContent,
3289
- Enumerated: Enumerated,
3290
- GeneralString: GeneralString,
3291
- GeneralizedTime: GeneralizedTime,
3292
- GraphicString: GraphicString,
3293
- HexBlock: HexBlock,
3294
- IA5String: IA5String,
3295
- Integer: Integer,
3296
- Null: Null,
3297
- NumericString: NumericString,
3298
- ObjectIdentifier: ObjectIdentifier,
3299
- OctetString: OctetString$1,
3300
- Primitive: Primitive,
3301
- PrintableString: PrintableString,
3302
- RawData: RawData,
3303
- RelativeObjectIdentifier: RelativeObjectIdentifier,
3304
- Repeated: Repeated,
3305
- Sequence: Sequence,
3306
- Set: Set,
3307
- TIME: TIME,
3308
- TeletexString: TeletexString,
3309
- TimeOfDay: TimeOfDay,
3310
- UTCTime: UTCTime,
3311
- UniversalString: UniversalString,
3312
- Utf8String: Utf8String,
3313
- ValueBlock: ValueBlock,
3314
- VideotexString: VideotexString,
3315
- ViewWriter: ViewWriter,
3316
- VisibleString: VisibleString,
3317
- compareSchema: compareSchema,
3318
- fromBER: fromBER,
3319
- verifySchema: verifySchema
3303
+ __proto__: null,
3304
+ Any: Any,
3305
+ BaseBlock: BaseBlock,
3306
+ BaseStringBlock: BaseStringBlock,
3307
+ BitString: BitString$1,
3308
+ BmpString: BmpString,
3309
+ Boolean: Boolean,
3310
+ CharacterString: CharacterString,
3311
+ Choice: Choice,
3312
+ Constructed: Constructed,
3313
+ DATE: DATE,
3314
+ DateTime: DateTime,
3315
+ Duration: Duration,
3316
+ EndOfContent: EndOfContent,
3317
+ Enumerated: Enumerated,
3318
+ GeneralString: GeneralString,
3319
+ GeneralizedTime: GeneralizedTime,
3320
+ GraphicString: GraphicString,
3321
+ HexBlock: HexBlock,
3322
+ IA5String: IA5String,
3323
+ Integer: Integer,
3324
+ Null: Null,
3325
+ NumericString: NumericString,
3326
+ ObjectIdentifier: ObjectIdentifier,
3327
+ OctetString: OctetString$1,
3328
+ Primitive: Primitive,
3329
+ PrintableString: PrintableString,
3330
+ RawData: RawData,
3331
+ RelativeObjectIdentifier: RelativeObjectIdentifier,
3332
+ Repeated: Repeated,
3333
+ Sequence: Sequence,
3334
+ Set: Set,
3335
+ TIME: TIME,
3336
+ TeletexString: TeletexString,
3337
+ TimeOfDay: TimeOfDay,
3338
+ UTCTime: UTCTime,
3339
+ UniversalString: UniversalString,
3340
+ Utf8String: Utf8String,
3341
+ ValueBlock: ValueBlock,
3342
+ VideotexString: VideotexString,
3343
+ ViewWriter: ViewWriter,
3344
+ VisibleString: VisibleString,
3345
+ compareSchema: compareSchema,
3346
+ fromBER: fromBER,
3347
+ verifySchema: verifySchema
3320
3348
  });
3321
3349
 
3322
3350
  var AsnTypeTypes;
@@ -3490,9 +3518,9 @@ class BitString {
3490
3518
  if (typeof params === "number") {
3491
3519
  this.fromNumber(params);
3492
3520
  }
3493
- else if (download.build.BufferSourceConverter.isBufferSource(params)) {
3521
+ else if (index.build.BufferSourceConverter.isBufferSource(params)) {
3494
3522
  this.unusedBits = unusedBits;
3495
- this.value = download.build.BufferSourceConverter.toArrayBuffer(params);
3523
+ this.value = index.build.BufferSourceConverter.toArrayBuffer(params);
3496
3524
  }
3497
3525
  else {
3498
3526
  throw TypeError("Unsupported type of 'params' argument for BitString");
@@ -3546,8 +3574,8 @@ class OctetString {
3546
3574
  this.buffer = new ArrayBuffer(param);
3547
3575
  }
3548
3576
  else {
3549
- if (download.build.BufferSourceConverter.isBufferSource(param)) {
3550
- this.buffer = download.build.BufferSourceConverter.toArrayBuffer(param);
3577
+ if (index.build.BufferSourceConverter.isBufferSource(param)) {
3578
+ this.buffer = index.build.BufferSourceConverter.toArrayBuffer(param);
3551
3579
  }
3552
3580
  else if (Array.isArray(param)) {
3553
3581
  this.buffer = new Uint8Array(param);
@@ -4090,8 +4118,8 @@ class AsnConvert {
4090
4118
  return AsnParser.parse(data, target);
4091
4119
  }
4092
4120
  static toString(data) {
4093
- const buf = download.build.BufferSourceConverter.isBufferSource(data)
4094
- ? download.build.BufferSourceConverter.toArrayBuffer(data)
4121
+ const buf = index.build.BufferSourceConverter.isBufferSource(data)
4122
+ ? index.build.BufferSourceConverter.toArrayBuffer(data)
4095
4123
  : AsnConvert.serialize(data);
4096
4124
  const asn = fromBER(buf);
4097
4125
  if (asn.offset === -1) {
@@ -5144,7 +5172,7 @@ class IpConverter {
5144
5172
  const addr = ipaddr.fromByteArray(Array.from(uint8));
5145
5173
  return addr.toString();
5146
5174
  }
5147
- return this.decodeIP(download.build.Convert.ToHex(buf));
5175
+ return this.decodeIP(index.build.Convert.ToHex(buf));
5148
5176
  }
5149
5177
  static fromString(text) {
5150
5178
  const addr = ipaddr.parse(text);
@@ -5186,7 +5214,7 @@ let AttributeValue = class AttributeValue extends DirectoryString {
5186
5214
  Object.assign(this, params);
5187
5215
  }
5188
5216
  toString() {
5189
- return this.ia5String || (this.anyValue ? download.build.Convert.ToHex(this.anyValue) : super.toString());
5217
+ return this.ia5String || (this.anyValue ? index.build.Convert.ToHex(this.anyValue) : super.toString());
5190
5218
  }
5191
5219
  };
5192
5220
  __decorate([
@@ -5981,7 +6009,7 @@ class AlgorithmIdentifier {
5981
6009
  return data instanceof AlgorithmIdentifier
5982
6010
  && data.algorithm == this.algorithm
5983
6011
  && ((data.parameters && this.parameters
5984
- && download.build.isEqual(data.parameters, this.parameters))
6012
+ && index.build.isEqual(data.parameters, this.parameters))
5985
6013
  ||
5986
6014
  (data.parameters === this.parameters));
5987
6015
  }
@@ -6512,34 +6540,6 @@ __decorate([
6512
6540
  AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
6513
6541
  ], RSAPublicKey.prototype, "publicExponent", void 0);
6514
6542
 
6515
- /**
6516
- * @license
6517
- * Copyright (c) Peculiar Ventures, LLC.
6518
- *
6519
- * This source code is licensed under the MIT license found in the
6520
- * LICENSE file in the root directory of this source tree.
6521
- */
6522
- /* eslint-disable no-useless-escape */
6523
- const isHex = (value) => (/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
6524
- .test(value));
6525
- const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/
6526
- .test(value));
6527
- const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
6528
- .test(value));
6529
- const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
6530
- .test(value));
6531
- const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
6532
- .test(value));
6533
- const isBase64 = (value) => {
6534
- try {
6535
- window.atob(value);
6536
- return true;
6537
- }
6538
- catch (error) {
6539
- return false;
6540
- }
6541
- };
6542
-
6543
6543
  /**
6544
6544
  * @license
6545
6545
  * Copyright (c) Peculiar Ventures, LLC.
@@ -8873,7 +8873,7 @@ var _Name_asn;
8873
8873
  class Name {
8874
8874
  constructor(data) {
8875
8875
  _Name_asn.set(this, new exports.Name$1());
8876
- if (download.build.BufferSourceConverter.isBufferSource(data)) {
8876
+ if (index.build.BufferSourceConverter.isBufferSource(data)) {
8877
8877
  __classPrivateFieldSet$1(this, _Name_asn, AsnParser.parse(data, exports.Name$1), "f");
8878
8878
  }
8879
8879
  else {
@@ -9078,8 +9078,8 @@ exports.CaVersion = class CaVersion {
9078
9078
  data.set(new Uint8Array(this.value), 4 - this.value.byteLength);
9079
9079
  }
9080
9080
  return {
9081
- keyIndex: parseInt(download.build.Convert.ToHex(data.slice(0, 2)), 16),
9082
- certificateIndex: parseInt(download.build.Convert.ToHex(data.slice(2)), 16),
9081
+ keyIndex: parseInt(index.build.Convert.ToHex(data.slice(0, 2)), 16),
9082
+ certificateIndex: parseInt(index.build.Convert.ToHex(data.slice(2)), 16),
9083
9083
  };
9084
9084
  }
9085
9085
  };
@@ -9497,7 +9497,7 @@ exports.LeiRole = __decorate([
9497
9497
  class ByteStream {
9498
9498
  constructor(bytes) {
9499
9499
  this.offset = 0;
9500
- this.view = download.build.BufferSourceConverter.toUint8Array(bytes);
9500
+ this.view = index.build.BufferSourceConverter.toUint8Array(bytes);
9501
9501
  }
9502
9502
  get position() {
9503
9503
  return this.offset;
@@ -9516,7 +9516,7 @@ class ByteStream {
9516
9516
  }
9517
9517
  readNumber(size) {
9518
9518
  const bytes = this.read(size);
9519
- const hex = download.build.Convert.ToHex(bytes);
9519
+ const hex = index.build.Convert.ToHex(bytes);
9520
9520
  return parseInt(hex, 16);
9521
9521
  }
9522
9522
  readEnd() {
@@ -9529,7 +9529,7 @@ class ByteStream {
9529
9529
 
9530
9530
  class Structure {
9531
9531
  static createStream(bytes) {
9532
- const view = download.build.BufferSourceConverter.toUint8Array(bytes);
9532
+ const view = index.build.BufferSourceConverter.toUint8Array(bytes);
9533
9533
  return new ByteStream(view);
9534
9534
  }
9535
9535
  }
@@ -9573,7 +9573,7 @@ class SignedCertificateTimestamp extends Structure {
9573
9573
  parse(stream) {
9574
9574
  this.version = stream.readByte();
9575
9575
  stream.read(2);
9576
- this.logId = download.build.BufferSourceConverter.toArrayBuffer(stream.read(32));
9576
+ this.logId = index.build.BufferSourceConverter.toArrayBuffer(stream.read(32));
9577
9577
  this.timestamp = new Date(stream.readNumber(8));
9578
9578
  const extLen = stream.readNumber(2);
9579
9579
  this.extensions = stream.read(extLen).buffer;
@@ -9584,12 +9584,12 @@ class SignedCertificateTimestamp extends Structure {
9584
9584
  toJSON() {
9585
9585
  return {
9586
9586
  version: this.version,
9587
- logId: download.build.Convert.ToHex(this.logId),
9587
+ logId: index.build.Convert.ToHex(this.logId),
9588
9588
  timestamp: this.timestamp,
9589
- extensions: download.build.Convert.ToBase64(this.extensions),
9589
+ extensions: index.build.Convert.ToBase64(this.extensions),
9590
9590
  hashAlgorithm: HashAlgorithm[this.hashAlgorithm] || "undefined",
9591
9591
  signatureAlgorithm: SignatureAlgorithm[this.signatureAlgorithm] || "undefined",
9592
- signature: download.build.Convert.ToBase64(this.signature),
9592
+ signature: index.build.Convert.ToBase64(this.signature),
9593
9593
  };
9594
9594
  }
9595
9595
  }
@@ -10011,7 +10011,7 @@ class AsnData {
10011
10011
  else {
10012
10012
  // raw, type
10013
10013
  __classPrivateFieldSet(this, _AsnData_asn, AsnConvert.parse(args[0], args[1]), "f");
10014
- __classPrivateFieldSet(this, _AsnData_raw, download.build.BufferSourceConverter.toArrayBuffer(args[0]), "f");
10014
+ __classPrivateFieldSet(this, _AsnData_raw, index.build.BufferSourceConverter.toArrayBuffer(args[0]), "f");
10015
10015
  }
10016
10016
  }
10017
10017
  get asn() {
@@ -10145,12 +10145,12 @@ class Extension extends AsnData {
10145
10145
  break;
10146
10146
  default:
10147
10147
  console.warn(`Didn't detect parser for "${this.asn.extnID}" extension.`);
10148
- this.value = download.build.Convert.ToHex(asnExtnValue);
10148
+ this.value = index.build.Convert.ToHex(asnExtnValue);
10149
10149
  }
10150
10150
  }
10151
10151
  catch (error) {
10152
10152
  console.error(`Error parse "${this.asn.extnID}" extension:`, error.message);
10153
- this.value = download.build.Convert.ToHex(asnExtnValue);
10153
+ this.value = index.build.Convert.ToHex(asnExtnValue);
10154
10154
  }
10155
10155
  }
10156
10156
  getAsnExtnValue() {
@@ -10213,13 +10213,13 @@ const certificateRawToBuffer = (raw) => {
10213
10213
  const rawClarified = base64Clarify(raw);
10214
10214
  let buffer;
10215
10215
  if (isHex(rawClarified)) {
10216
- buffer = download.build.Convert.FromHex(rawClarified);
10216
+ buffer = index.build.Convert.FromHex(rawClarified);
10217
10217
  }
10218
10218
  else if (isBase64(rawClarified) || isPem(rawClarified)) {
10219
- buffer = download.build.Convert.FromBase64(rawClarified);
10219
+ buffer = index.build.Convert.FromBase64(rawClarified);
10220
10220
  }
10221
10221
  else {
10222
- buffer = download.build.Convert.FromBinary(raw);
10222
+ buffer = index.build.Convert.FromBinary(raw);
10223
10223
  }
10224
10224
  return buffer;
10225
10225
  };
@@ -10231,135 +10231,6 @@ const getCertificateThumbprint = async (algorithm, data) => {
10231
10231
  return undefined;
10232
10232
  };
10233
10233
 
10234
- /**
10235
- * @license
10236
- * Copyright (c) Peculiar Ventures, LLC.
10237
- *
10238
- * This source code is licensed under the MIT license found in the
10239
- * LICENSE file in the root directory of this source tree.
10240
- */
10241
- class X509Certificate extends AsnData {
10242
- constructor(raw) {
10243
- super(certificateRawToBuffer(raw), Certificate);
10244
- this.thumbprints = {};
10245
- this.type = 'X.509 Certificate';
10246
- const { tbsCertificate } = this.asn;
10247
- this.serialNumber = download.build.Convert.ToHex(tbsCertificate.serialNumber);
10248
- this.subject = new Name(tbsCertificate.subject).toJSON();
10249
- this.issuer = new Name(tbsCertificate.issuer).toJSON();
10250
- this.version = tbsCertificate.version + 1;
10251
- const notBefore = tbsCertificate.validity.notBefore.utcTime
10252
- || tbsCertificate.validity.notBefore.generalTime;
10253
- if (!notBefore) {
10254
- throw new Error("Cannot get 'notBefore' value");
10255
- }
10256
- this.notBefore = notBefore;
10257
- const notAfter = tbsCertificate.validity.notAfter.utcTime
10258
- || tbsCertificate.validity.notAfter.generalTime;
10259
- if (!notAfter) {
10260
- throw new Error("Cannot get 'notAfter' value");
10261
- }
10262
- this.notAfter = notAfter;
10263
- this.validity = l10n.dateDiff(this.notBefore, this.notAfter);
10264
- }
10265
- parseExtensions() {
10266
- const { tbsCertificate } = this.asn;
10267
- if (tbsCertificate.extensions) {
10268
- this.extensions = tbsCertificate.extensions
10269
- .map((e) => new Extension(AsnConvert.serialize(e)));
10270
- }
10271
- }
10272
- get publicKey() {
10273
- const { subjectPublicKey, algorithm } = this.asn.tbsCertificate.subjectPublicKeyInfo;
10274
- let params;
10275
- if (algorithm.algorithm === id_ecPublicKey && algorithm.parameters) {
10276
- params = AsnConvert.parse(algorithm.parameters, exports.ECParameters);
10277
- }
10278
- if (algorithm.algorithm === id_rsaEncryption) {
10279
- params = AsnConvert.parse(subjectPublicKey, RSAPublicKey);
10280
- }
10281
- const spki = AsnConvert.serialize(this.asn.tbsCertificate.subjectPublicKeyInfo);
10282
- return {
10283
- params,
10284
- value: spki,
10285
- algorithm: algorithm.algorithm,
10286
- };
10287
- }
10288
- get signature() {
10289
- const { signatureValue, signatureAlgorithm } = this.asn;
10290
- return {
10291
- value: signatureValue,
10292
- algorithm: signatureAlgorithm.algorithm,
10293
- };
10294
- }
10295
- exportAsBase64() {
10296
- return download.build.Convert.ToBase64(this.raw);
10297
- }
10298
- exportAsHexFormatted() {
10299
- return hexFormat(download.build.Convert.ToHex(this.raw));
10300
- }
10301
- exportAsPemFormatted() {
10302
- return `-----BEGIN CERTIFICATE-----\n${base64Format(this.exportAsBase64())}\n-----END CERTIFICATE-----`;
10303
- }
10304
- async getThumbprint(algorithm = 'SHA-1') {
10305
- try {
10306
- const thumbprint = await getCertificateThumbprint(algorithm, this.raw);
10307
- if (thumbprint) {
10308
- this.thumbprints[algorithm['name'] || algorithm] = download.build.Convert.ToHex(thumbprint);
10309
- }
10310
- }
10311
- catch (error) {
10312
- console.error('Error thumbprint get:', error);
10313
- }
10314
- }
10315
- get commonName() {
10316
- if (!this.subject) {
10317
- return '';
10318
- }
10319
- for (let i = 0; i < this.subject.length; i += 1) {
10320
- const name = this.subject[i];
10321
- if (name.shortName === 'CN' || name.shortName === 'E' || name.shortName === 'O') {
10322
- return name.value;
10323
- }
10324
- }
10325
- return '';
10326
- }
10327
- get issuerCommonName() {
10328
- if (!this.issuer) {
10329
- return '';
10330
- }
10331
- for (let i = 0; i < this.issuer.length; i += 1) {
10332
- const name = this.issuer[i];
10333
- if (name.shortName === 'CN') {
10334
- return name.value;
10335
- }
10336
- if (name.shortName === 'E') {
10337
- return name.value;
10338
- }
10339
- }
10340
- return '';
10341
- }
10342
- get isRoot() {
10343
- return JSON.stringify(this.issuer) === JSON.stringify(this.subject);
10344
- }
10345
- subjectToString() {
10346
- if (!this.subject) {
10347
- return '';
10348
- }
10349
- return this.subject
10350
- .map((name) => (`${name.shortName}=${name.value}`))
10351
- .join(', ');
10352
- }
10353
- issuerToString() {
10354
- if (!this.issuer) {
10355
- return '';
10356
- }
10357
- return this.issuer
10358
- .map((name) => (`${name.shortName}=${name.value}`))
10359
- .join(', ');
10360
- }
10361
- }
10362
-
10363
10234
  class ACClearAttrs {
10364
10235
  constructor(params = {}) {
10365
10236
  this.acIssuer = new GeneralName();
@@ -11646,6 +11517,7 @@ exports.Attribute = Attribute$1;
11646
11517
  exports.AttributeCertificate = AttributeCertificate;
11647
11518
  exports.AuthorityKeyIdentifier = AuthorityKeyIdentifier;
11648
11519
  exports.BasicConstraints = BasicConstraints;
11520
+ exports.Certificate = Certificate;
11649
11521
  exports.CertificateTemplate = CertificateTemplate;
11650
11522
  exports.CertificateTransparency = CertificateTransparency;
11651
11523
  exports.CertificationRequest = CertificationRequest;
@@ -11665,7 +11537,6 @@ exports.RSAPublicKey = RSAPublicKey;
11665
11537
  exports.SubjectKeyIdentifier = SubjectKeyIdentifier;
11666
11538
  exports.Timestamp = Timestamp;
11667
11539
  exports.UserNotice = UserNotice;
11668
- exports.X509Certificate = X509Certificate;
11669
11540
  exports.base64Format = base64Format;
11670
11541
  exports.certificateRawToBuffer = certificateRawToBuffer;
11671
11542
  exports.getCertificateThumbprint = getCertificateThumbprint;