@lapo/asn1js 2.0.4-prev → 2.0.5

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  ISC License
2
2
 
3
- Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
3
+ Copyright (c) 2008-2025 Lapo Luchini <lapo@lapo.it>
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
package/README.md CHANGED
@@ -3,7 +3,7 @@ asn1js
3
3
 
4
4
  asn1js is a JavaScript generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.
5
5
 
6
- An example page that can decode Base64-encoded (raw base64, PEM armoring and `begin-base64` are recognized) or Hex-encoded (or local files with some browsers) is included and can be used both [online on the official website](https://lapo.it/asn1js/) or [offline (ZIP file)](https://lapo.it/asn1js/asn1js.zip).
6
+ An example page that can decode Base64-encoded (raw base64, PEM armoring and `begin-base64` are recognized) or Hex-encoded (or local files with some browsers) is included and can be used both [online on the official website](https://asn1js.eu/) or [offline (ZIP file)](https://lapo.it/asn1js/asn1js.zip) by opening `index-local.html`.
7
7
 
8
8
  Usage with `nodejs`
9
9
  -------------------
@@ -67,12 +67,21 @@ document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content();
67
67
  Local usage
68
68
  --------------------
69
69
 
70
- Since unfortunately ESM modules are not working on `file:` protocol due to [CORS issues](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#other_differences_between_modules_and_standard_scripts), there is a bundled [single-file version working locally](https://asn1js.eu/index-local.html). It doesn't work online (due to [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) restrictions about inline content) but can be saved locally and opened in a browser. ([known bug](https://github.com/lapo-luchini/asn1js/issues/89): dark mode is currently broken in this mode)
70
+ Since unfortunately ESM modules are not working on `file:` protocol due to [CORS issues](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#other_differences_between_modules_and_standard_scripts), there is a bundled [single-file version working locally](https://asn1js.eu/index-local.html). It doesn't work online (due to [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) restrictions about inline content) but can be saved locally and opened in a browser.
71
+
72
+ Usage from CLI
73
+ --------------------
74
+
75
+ You can dump an ASN.1 structure from the command line using the following command (no need to even install it):
76
+
77
+ ```sh
78
+ npx @lapo/asn1js ed25519.cer
79
+ ```
71
80
 
72
81
  ISC license
73
82
  -----------
74
83
 
75
- ASN.1 JavaScript decoder Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
84
+ ASN.1 JavaScript decoder Copyright (c) 2008-2025 Lapo Luchini <lapo@lapo.it>
76
85
 
77
86
  Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
78
87
 
package/asn1.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // ASN.1 JavaScript decoder
2
- // Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
2
+ // Copyright (c) 2008 Lapo Luchini <lapo@lapo.it>
3
3
 
4
4
  // Permission to use, copy, modify, and/or distribute this software for any
5
5
  // purpose with or without fee is hereby granted, provided that the above
6
6
  // copyright notice and this permission notice appear in all copies.
7
- //
7
+ //
8
8
  // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
9
  // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
10
  // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -56,36 +56,55 @@ function checkPrintable(s) {
56
56
  }
57
57
  }
58
58
 
59
+ /** Class to manage a stream of bytes, with a zero-copy approach.
60
+ * It uses an existing array or binary string and advances a position index. */
59
61
  class Stream {
60
62
 
63
+ /**
64
+ * @param {Stream|array|string} enc data (will not be copied)
65
+ * @param {?number} pos starting position (mandatory when `end` is not a Stream)
66
+ */
61
67
  constructor(enc, pos) {
62
68
  if (enc instanceof Stream) {
63
69
  this.enc = enc.enc;
64
70
  this.pos = enc.pos;
65
71
  } else {
66
- // enc should be an array or a binary string
67
72
  this.enc = enc;
68
73
  this.pos = pos;
69
74
  }
70
- }
75
+ if (typeof this.pos != 'number')
76
+ throw new Error('"pos" must be a numeric value');
77
+ if (typeof this.enc == 'string')
78
+ this.getRaw = pos => this.enc.charCodeAt(pos);
79
+ else if (typeof this.enc[0] == 'number')
80
+ this.getRaw = pos => this.enc[pos];
81
+ else
82
+ throw new Error('"enc" must be a numeric array or a string');
83
+ }
84
+ /** Get the byte at current position (and increment it) or at a specified position (and avoid moving current position).
85
+ * @param {?number} pos read position if specified, else current position (and increment it) */
71
86
  get(pos) {
72
87
  if (pos === undefined)
73
88
  pos = this.pos++;
74
89
  if (pos >= this.enc.length)
75
90
  throw new Error('Requesting byte offset ' + pos + ' on a stream of length ' + this.enc.length);
76
- return (typeof this.enc == 'string') ? this.enc.charCodeAt(pos) : this.enc[pos];
91
+ return this.getRaw(pos);
77
92
  }
78
- hexByte(b) {
93
+ /** Convert a single byte to an hexadcimal string (of length 2).
94
+ * @param {number} b */
95
+ static hexByte(b) {
79
96
  return hexDigits.charAt((b >> 4) & 0xF) + hexDigits.charAt(b & 0xF);
80
97
  }
81
- /** Hexadecimal dump.
82
- * @param type 'raw', 'byte' or 'dump' */
98
+ /** Hexadecimal dump of a specified region of the stream.
99
+ * @param {number} start starting position (included)
100
+ * @param {number} end ending position (excluded)
101
+ * @param {string} type 'raw', 'byte' or 'dump' */
83
102
  hexDump(start, end, type = 'dump') {
84
103
  let s = '';
85
104
  for (let i = start; i < end; ++i) {
86
105
  if (type == 'byte' && i > start)
87
106
  s += ' ';
88
- s += this.hexByte(this.get(i));
107
+ s += Stream.hexByte(this.get(i));
89
108
  if (type == 'dump')
90
109
  switch (i & 0xF) {
91
110
  case 0x7: s += ' '; break;
@@ -95,6 +114,9 @@ class Stream {
95
114
  }
96
115
  return s;
97
116
  }
117
+ /** Base-64 dump of a specified region of the stream.
118
+ * @param {number} start starting position (included)
119
+ * @param {number} end ending position (excluded) */
98
120
  b64Dump(start, end) {
99
121
  let extra = (end - start) % 3,
100
122
  s = '',
@@ -277,7 +299,7 @@ class Stream {
277
299
  end = start + maxLength;
278
300
  s = '';
279
301
  for (let i = start; i < end; ++i)
280
- s += this.hexByte(this.get(i));
302
+ s += Stream.hexByte(this.get(i));
281
303
  if (len > maxLength)
282
304
  s += ellipsis;
283
305
  return { size: len, str: s };
package/base64.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Base64 JavaScript decoder
2
- // Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
2
+ // Copyright (c) 2008 Lapo Luchini <lapo@lapo.it>
3
3
 
4
4
  // Permission to use, copy, modify, and/or distribute this software for any
5
5
  // purpose with or without fee is hereby granted, provided that the above
6
6
  // copyright notice and this permission notice appear in all copies.
7
- //
7
+ //
8
8
  // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
9
  // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
10
  // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
package/defs.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // ASN.1 RFC definitions matcher
2
- // Copyright (c) 2023-2024 Lapo Luchini <lapo@lapo.it>
2
+ // Copyright (c) 2023 Lapo Luchini <lapo@lapo.it>
3
3
 
4
4
  // Permission to use, copy, modify, and/or distribute this software for any
5
5
  // purpose with or without fee is hereby granted, provided that the above
6
6
  // copyright notice and this permission notice appear in all copies.
7
- //
7
+ //
8
8
  // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
9
  // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
10
  // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -29,12 +29,13 @@ function translate(def, tn, stats) {
29
29
  def = Object.assign({}, def);
30
30
  def.type = Defs.searchType(name).type;
31
31
  }
32
- if (def?.type?.name == 'CHOICE') {
33
- for (let c of def.type.content) {
32
+ if (def?.name == 'CHOICE' || def?.type?.name == 'CHOICE') {
33
+ for (let c of def.content ?? def.type.content) {
34
34
  if (tn != c.type.name && tn != c.name)
35
35
  c = translate(c);
36
36
  if (tn == c.type.name || tn == c.name) {
37
37
  def = Object.assign({}, def);
38
+ if (c.id) def.id = c.id;
38
39
  def.type = c.type.name ? c.type : c;
39
40
  break;
40
41
  }
@@ -127,12 +128,14 @@ export class Defs {
127
128
  Defs.RFC = rfcdef;
128
129
 
129
130
  Defs.commonTypes = [
130
- [ 'X.509 certificate', '1.3.6.1.5.5.7.0.18', 'Certificate' ],
131
+ [ 'X.509 certificate', '1.3.6.1.5.5.7.0.18', 'Certificate' ],
131
132
  [ 'X.509 public key info', '1.3.6.1.5.5.7.0.18', 'SubjectPublicKeyInfo' ],
133
+ [ 'X.509 certificate revocation list', '1.3.6.1.5.5.7.0.18', 'CertificateList' ],
132
134
  [ 'CMS / PKCS#7 envelope', '1.2.840.113549.1.9.16.0.14', 'ContentInfo' ],
133
135
  [ 'PKCS#1 RSA private key', '1.2.840.113549.1.1.0.1', 'RSAPrivateKey' ],
134
136
  [ 'PKCS#8 encrypted private key', '1.2.840.113549.1.8.1.1', 'EncryptedPrivateKeyInfo' ],
135
137
  [ 'PKCS#8 private key', '1.2.840.113549.1.8.1.1', 'PrivateKeyInfo' ],
136
138
  [ 'PKCS#10 certification request', '1.2.840.113549.1.10.1.1', 'CertificationRequest' ],
137
139
  [ 'CMP PKI Message', '1.3.6.1.5.5.7.0.16', 'PKIMessage' ],
140
+ [ 'LDAP Message', '1.3.6.1.1.18', 'LDAPMessage' ],
138
141
  ].map(arr => ({ description: arr[0], ...Defs.moduleAndType(rfcdef[arr[1]], arr[2]) }));
package/dom.js ADDED
@@ -0,0 +1,248 @@
1
+ // ASN.1 JavaScript decoder
2
+ // Copyright (c) 2008 Lapo Luchini <lapo@lapo.it>
3
+
4
+ // Permission to use, copy, modify, and/or distribute this software for any
5
+ // purpose with or without fee is hereby granted, provided that the above
6
+ // copyright notice and this permission notice appear in all copies.
7
+ //
8
+ // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
+ // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
+
16
+ import { ASN1 } from './asn1.js';
17
+ import { oids } from './oids.js';
18
+ import { bindContextMenu } from './context.js';
19
+
20
+ const
21
+ lineLength = 80,
22
+ contentLength = 8 * lineLength,
23
+ DOM = {
24
+ ellipsis: '\u2026',
25
+ tag: function (tagName, className, text) {
26
+ let t = document.createElement(tagName);
27
+ if (className) t.className = className;
28
+ if (text) t.innerText = text;
29
+ return t;
30
+ },
31
+ text: function (str) {
32
+ return document.createTextNode(str);
33
+ },
34
+ space: function () {
35
+ return DOM.tag('span', 'spaces', ' ');
36
+ },
37
+ breakLines: function (str, length) {
38
+ let lines = str.split(/\r?\n/),
39
+ o = '';
40
+ for (let i = 0; i < lines.length; ++i) {
41
+ let line = lines[i];
42
+ if (i > 0) o += '\n';
43
+ while (line.length > length) {
44
+ o += line.substring(0, length);
45
+ o += '\n';
46
+ line = line.substring(length);
47
+ }
48
+ o += line;
49
+ }
50
+ return o;
51
+ },
52
+ };
53
+
54
+ export class ASN1DOM extends ASN1 {
55
+
56
+ toDOM(spaces) {
57
+ spaces = spaces || '';
58
+ let isOID = (typeof oids === 'object') && (this.tag.isUniversal() && (this.tag.tagNumber == 0x06) || (this.tag.tagNumber == 0x0D));
59
+ let node = DOM.tag('li');
60
+ node.asn1 = this;
61
+ let head = DOM.tag('span', 'head');
62
+ const typeName = this.typeName().replace(/_/g, ' ');
63
+ if (this.def) {
64
+ if (this.def.id) {
65
+ head.appendChild(DOM.tag('span', 'name id', this.def.id));
66
+ head.appendChild(DOM.space());
67
+ }
68
+ if (this.def.name && this.def.name != typeName) {
69
+ head.appendChild(DOM.tag('span', 'name type', this.def.name));
70
+ head.appendChild(DOM.space());
71
+ }
72
+ if (this.def.mismatch) {
73
+ head.appendChild(DOM.tag('span', 'name type', '[?]'));
74
+ head.appendChild(DOM.space());
75
+ }
76
+ }
77
+ head.appendChild(DOM.text(typeName));
78
+ let content;
79
+ try {
80
+ content = this.content(contentLength);
81
+ } catch (e) {
82
+ content = 'Cannot decode: ' + e;
83
+ }
84
+ let oid;
85
+ if (content !== null) {
86
+ let preview = DOM.tag('span', 'preview'),
87
+ shortContent;
88
+ if (isOID)
89
+ content = content.split('\n', 1)[0];
90
+ shortContent = (content.length > lineLength) ? content.substring(0, lineLength) + DOM.ellipsis : content;
91
+ preview.appendChild(DOM.space());
92
+ preview.appendChild(DOM.text(shortContent));
93
+ if (isOID) {
94
+ oid = oids[content];
95
+ if (oid) {
96
+ if (oid.d) {
97
+ preview.appendChild(DOM.space());
98
+ let oidd = DOM.tag('span', 'oid description', oid.d);
99
+ preview.appendChild(oidd);
100
+ }
101
+ if (oid.c) {
102
+ preview.appendChild(DOM.space());
103
+ let oidc = DOM.tag('span', 'oid comment', '(' + oid.c + ')');
104
+ preview.appendChild(oidc);
105
+ }
106
+ }
107
+ }
108
+ head.appendChild(preview);
109
+ content = DOM.breakLines(content, lineLength);
110
+ content = content.replace(/</g, '&lt;');
111
+ content = content.replace(/\n/g, '<br>');
112
+ }
113
+ // add the li and details section for this node
114
+ let contentNode;
115
+ let childNode;
116
+ if (this.sub !== null) {
117
+ let details = DOM.tag('details');
118
+ details.setAttribute('open', '');
119
+ node.appendChild(details);
120
+ let summary = DOM.tag('summary', 'node');
121
+ details.appendChild(summary);
122
+ summary.appendChild(head);
123
+ contentNode = summary;
124
+ childNode = details;
125
+ } else {
126
+ contentNode = node;
127
+ contentNode.classList.add('node');
128
+ contentNode.appendChild(head);
129
+ }
130
+ this.node = contentNode;
131
+ this.head = head;
132
+ let value = DOM.tag('div', 'value');
133
+ let s = 'Offset: ' + this.stream.pos + '<br>';
134
+ s += 'Length: ' + this.header + '+';
135
+ if (this.length >= 0)
136
+ s += this.length;
137
+ else
138
+ s += (-this.length) + ' (undefined)';
139
+ if (this.tag.tagConstructed)
140
+ s += '<br>(constructed)';
141
+ else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null))
142
+ s += '<br>(encapsulates)';
143
+ //TODO if (this.tag.isUniversal() && this.tag.tagNumber == 0x03) s += "Unused bits: "
144
+ if (content !== null) {
145
+ s += '<br>Value:<br><b>' + content + '</b>';
146
+ if (isOID && oid) {
147
+ if (oid.d) s += '<br>' + oid.d;
148
+ if (oid.c) s += '<br>' + oid.c;
149
+ if (oid.w) s += '<br>(warning!)';
150
+ }
151
+ }
152
+ value.innerHTML = s;
153
+ contentNode.appendChild(value);
154
+ if (this.sub !== null) {
155
+ let sub = DOM.tag('ul');
156
+ childNode.appendChild(sub);
157
+ spaces += '\xA0 ';
158
+ for (let i = 0, max = this.sub.length; i < max; ++i)
159
+ sub.appendChild(this.sub[i].toDOM(spaces));
160
+ }
161
+ bindContextMenu(node);
162
+ return node;
163
+ }
164
+ fakeHover(current) {
165
+ this.node.classList.add('hover');
166
+ if (current)
167
+ this.head.classList.add('hover');
168
+ }
169
+ fakeOut(current) {
170
+ this.node.classList.remove('hover');
171
+ if (current)
172
+ this.head.classList.remove('hover');
173
+ }
174
+ toHexDOM_sub(node, className, stream, start, end) {
175
+ if (start >= end)
176
+ return;
177
+ let sub = DOM.tag('span', className, stream.hexDump(start, end));
178
+ node.appendChild(sub);
179
+ }
180
+ toHexDOM(root, trim=true) {
181
+ let node = DOM.tag('span', 'hex');
182
+ if (root === undefined) root = node;
183
+ this.head.hexNode = node;
184
+ this.head.onmouseover = function () { this.hexNode.className = 'hexCurrent'; };
185
+ this.head.onmouseout = function () { this.hexNode.className = 'hex'; };
186
+ node.asn1 = this;
187
+ node.onmouseover = function (event) {
188
+ let current = !root.selected;
189
+ if (current) {
190
+ root.selected = this.asn1;
191
+ this.className = 'hexCurrent';
192
+ }
193
+ this.asn1.fakeHover(current);
194
+ event.stopPropagation();
195
+ };
196
+ node.onmouseout = function () {
197
+ let current = (root.selected == this.asn1);
198
+ this.asn1.fakeOut(current);
199
+ if (current) {
200
+ root.selected = null;
201
+ this.className = 'hex';
202
+ }
203
+ };
204
+ bindContextMenu(node);
205
+ if (root == node) {
206
+ let lineStart = this.posStart() & 0xF;
207
+ if (lineStart != 0) {
208
+ let skip = DOM.tag('span', 'skip');
209
+ let skipStr = '';
210
+ for (let j = lineStart; j > 0; --j)
211
+ skipStr += ' ';
212
+ if (lineStart >= 8)
213
+ skipStr += ' ';
214
+ skip.innerText = skipStr;
215
+ node.appendChild(skip);
216
+ }
217
+ }
218
+ this.toHexDOM_sub(node, 'tag', this.stream, this.posStart(), this.posLen());
219
+ this.toHexDOM_sub(node, (this.length >= 0) ? 'dlen' : 'ulen', this.stream, this.posLen(), this.posContent());
220
+ if (this.sub === null) {
221
+ let start = this.posContent();
222
+ let end = this.posEnd();
223
+ if (!trim || end - start < 10 * 16)
224
+ node.appendChild(DOM.text(
225
+ this.stream.hexDump(start, end)));
226
+ else {
227
+ let end1 = start + 5 * 16 - (start & 0xF);
228
+ let start2 = end - 16 - (end & 0xF);
229
+ node.appendChild(DOM.text(this.stream.hexDump(start, end1)));
230
+ node.appendChild(DOM.tag('span', 'skip', '\u2026 skipping ' + (start2 - end1) + ' bytes \u2026\n'));
231
+ node.appendChild(DOM.text(this.stream.hexDump(start2, end)));
232
+ }
233
+ } else if (this.sub.length > 0) {
234
+ let first = this.sub[0];
235
+ let last = this.sub[this.sub.length - 1];
236
+ this.toHexDOM_sub(node, 'intro', this.stream, this.posContent(), first.posStart());
237
+ for (let i = 0, max = this.sub.length; i < max; ++i)
238
+ node.appendChild(this.sub[i].toHexDOM(root, trim));
239
+ this.toHexDOM_sub(node, 'outro', this.stream, last.posEnd(), this.posEnd());
240
+ } else
241
+ this.toHexDOM_sub(node, 'outro', this.stream, this.posContent(), this.posEnd());
242
+ return node;
243
+ }
244
+ static decode(stream, offset) {
245
+ return ASN1.decode(stream, offset, ASN1DOM);
246
+ }
247
+
248
+ }
package/dumpASN1.js CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // usage:
4
+ // ./dumpASN1.js filename
5
+ // ./dumpASN1.js data:base64,MDMCAQFjLgQACgEACgEAAgEAAgEAAQEAoA+jDQQFTnRWZXIEBAEAAAAwCgQITmV0bG9nb24===
6
+
3
7
  import * as fs from 'node:fs';
4
8
  import { Base64 } from './base64.js';
5
9
  import { ASN1 } from './asn1.js';
package/hex.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Hex JavaScript decoder
2
- // Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
2
+ // Copyright (c) 2008 Lapo Luchini <lapo@lapo.it>
3
3
 
4
4
  // Permission to use, copy, modify, and/or distribute this software for any
5
5
  // purpose with or without fee is hereby granted, provided that the above
6
6
  // copyright notice and this permission notice appear in all copies.
7
- //
7
+ //
8
8
  // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
9
  // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
10
  // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
package/int10.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Big integer base-10 printing library
2
- // Copyright (c) 2008-2024 Lapo Luchini <lapo@lapo.it>
2
+ // Copyright (c) 2008 Lapo Luchini <lapo@lapo.it>
3
3
 
4
4
  // Permission to use, copy, modify, and/or distribute this software for any
5
5
  // purpose with or without fee is hereby granted, provided that the above
6
6
  // copyright notice and this permission notice appear in all copies.
7
- //
7
+ //
8
8
  // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
9
  // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
10
  // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lapo/asn1js",
3
- "version": "2.0.4-prev",
3
+ "version": "2.0.5",
4
4
  "description": "Generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.",
5
5
  "type": "module",
6
6
  "main": "asn1.js",
@@ -13,9 +13,9 @@
13
13
  "license": "ISC",
14
14
  "bugs": { "url": "https://github.com/lapo-luchini/asn1js/issues" },
15
15
  "homepage": "https://lapo.it/asn1js/",
16
- "files": [ "asn1.js", "base64.js", "hex.js", "int10.js", "defs.js", "oids.js", "rfcdef.js", "dumpASN1.js" ],
16
+ "files": [ "asn1.js", "base64.js", "hex.js", "int10.js", "dom.js", "defs.js", "oids.js", "rfcdef.js", "dumpASN1.js" ],
17
17
  "scripts": {
18
- "lint": "npx eslint asn1.js base64.js hex.js int10.js defs.js oids.js rfcdef.js tags.js context.js index.js parseRFC.js dumpASN1.js test.js testDefs.js vite.config.js",
18
+ "lint": "npx eslint asn1.js base64.js hex.js int10.js dom.js defs.js oids.js rfcdef.js tags.js context.js index.js parseRFC.js dumpASN1.js test.js testDefs.js vite.config.js theme.js",
19
19
  "lint-action": "npx @action-validator/cli .github/workflows/node.js.yml",
20
20
  "build": "vite build",
21
21
  "serve": "echo 'Connect to http://localhost:3000/' ; npx statik --port 3000 .",
@@ -29,11 +29,12 @@
29
29
  "node": ">=12.20.0"
30
30
  },
31
31
  "devDependencies": {
32
- "eslint": "^8.34.0",
32
+ "@rollup/wasm-node": "^4.25.0",
33
+ "eslint": "^8.57.1",
33
34
  "htmlparser2": "^9.1.0",
34
- "vite": "^5.2.10",
35
- "vite-plugin-dom": "^1.0.3",
36
- "vite-plugin-singlefile": "^2.0.1"
35
+ "vite": "^5.4.10",
36
+ "vite-plugin-dom": "^1.0.4",
37
+ "vite-plugin-singlefile": "^2.0.3"
37
38
  },
38
39
  "overrides": {
39
40
  "rollup": "npm:@rollup/wasm-node"
@@ -60,7 +61,9 @@
60
61
  "rules": {
61
62
  "strict": [ "error", "function" ],
62
63
  "indent": [ "error", 4 ],
64
+ "no-trailing-spaces": [ "error" ],
63
65
  "linebreak-style": [ "error", "unix" ],
66
+ "eol-last": [ "error", "always" ],
64
67
  "semi": [ "warn", "always" ],
65
68
  "quotes": [ "error", "single", { "avoidEscape": true } ],
66
69
  "no-var": [ "warn" ],