@lapo/asn1js 1.3.0 → 2.0.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 (4) hide show
  1. package/README.md +10 -14
  2. package/asn1.js +1 -1
  3. package/oids.js +0 -1
  4. package/package.json +11 -6
package/README.md CHANGED
@@ -12,40 +12,36 @@ This package can be installed with either npm or yarn via the following commands
12
12
 
13
13
  ```sh
14
14
  npm install @lapo/asn1js
15
- # or with yarn
15
+ # or other tools
16
+ pnpm install @lapo/asn1js
16
17
  yarn add @lapo/asn1js
17
18
  ```
18
19
 
19
20
  Assuming a standard javascript bundler is setup you can import it like so:
20
21
 
21
22
  ```js
22
- const ASN1 = require('@lapo/asn1js');
23
- // or with ES modules
24
23
  import ASN1 from '@lapo/asn1js';
25
24
  ```
26
25
 
27
26
  A submodule of this package can also be imported:
28
27
 
29
28
  ```js
30
- const Hex = require('@lapo/asn1js/hex');
31
- // or with ES modules
32
29
  import Hex from '@lapo/asn1js/hex';
33
30
  ```
34
31
 
35
- Usage with RequireJS
32
+ Unfortunately until [`require(esm)` gets released](https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/) it is necessary to use async `import()` when used from CommonJS (legacy NodeJS) code.
33
+
34
+ Usage on the web
36
35
  --------------------
37
36
 
38
- Can be [tested on JSFiddle](https://jsfiddle.net/lapo/tmdq35ug/).
37
+ Can be [tested on JSFiddle](https://jsfiddle.net/lapo/y6t2wo7q/).
39
38
 
40
39
  ```html
41
- <script type="text/javascript" src="https://unpkg.com/requirejs/require.js"></script>
42
40
  <script>
43
- require([
44
- 'https://unpkg.com/@lapo/asn1js/asn1.js',
45
- 'https://unpkg.com/@lapo/asn1js/hex.js'
46
- ], function(ASN1, Hex) {
47
- document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content();
48
- });
41
+ import { ASN1} from 'https://unpkg.com/@lapo/asn1js@2.0.0/asn1.js';
42
+ import { Hex } from 'https://unpkg.com/@lapo/asn1js@2.0.0/hex.js';
43
+
44
+ document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content();
49
45
  </script>
50
46
  ```
51
47
 
package/asn1.js CHANGED
@@ -38,7 +38,7 @@ const
38
38
  ['', ''],
39
39
  ['OUou', 'ŐŰőű'], // Double Acute
40
40
  ['AEIUaeiu', 'ĄĘĮŲąęįų'], // Ogonek
41
- ['CDELNRSTZcdelnrstz', 'ČĎĚĽŇŘŠŤŽčďěľňřšťž'] // Caron
41
+ ['CDELNRSTZcdelnrstz', 'ČĎĚĽŇŘŠŤŽčďěľňřšťž'], // Caron
42
42
  ];
43
43
 
44
44
  function stringCut(str, len) {
package/oids.js CHANGED
@@ -2722,5 +2722,4 @@ export const oids = {
2722
2722
  "1.3.6.1.4.1.40869.1.1.22.3": { "d": "TWCA EV policy", "c": "TWCA Root Certification Authority" },
2723
2723
  "2.16.840.1.113733.1.7.23.6": { "d": "VeriSign EV policy", "c": "VeriSign Class 3 Public Primary Certification Authority" },
2724
2724
  "2.16.840.1.114171.500.9": { "d": "Wells Fargo EV policy", "c": "Wells Fargo WellsSecure Public Root Certificate Authority" },
2725
- "END": ""
2726
2725
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lapo/asn1js",
3
- "version": "1.3.0",
3
+ "version": "2.0.1",
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",
@@ -47,17 +47,21 @@
47
47
  "semi": [ "warn", "always" ],
48
48
  "quotes": [ "error", "single", { "avoidEscape": true } ],
49
49
  "no-var": [ "warn" ],
50
- "comma-dangle": [ "error", "never" ]
50
+ "comma-dangle": [ "error", "always-multiline" ]
51
51
  },
52
52
  "overrides": [
53
53
  {
54
+ "files": [ "defs.js" ],
55
+ "parserOptions": {
56
+ "ecmaVersion": 2020
57
+ }
58
+ }, {
54
59
  "files": [ "test.js", "parseRFC.js", "dumpASN1.js" ],
55
60
  "parserOptions": {
56
61
  "ecmaVersion": 2021
57
62
  },
58
63
  "rules": {
59
- "strict": [ "error", "global" ],
60
- "comma-dangle": [ "error", "always-multiline" ]
64
+ "strict": [ "error", "global" ]
61
65
  }
62
66
  }, {
63
67
  "files": [ "oids.js" ],
@@ -66,9 +70,10 @@
66
70
  "quotes": [ "warn", "double" ]
67
71
  }
68
72
  }, {
69
- "files": [ "tags.js" ],
73
+ "files": [ "tags.js", "rfcdef.js" ],
70
74
  "rules": {
71
- "comma-dangle": [ "error", "always-multiline" ],
75
+ "indent": [ "error", 2, { "ignoredNodes": [ "Program > ExpressionStatement > CallExpression > FunctionExpression > BlockStatement > ExpressionStatement[directive='use strict']:first-child" ] } ],
76
+ "comma-dangle": "off",
72
77
  "quotes": [ "warn", "double" ]
73
78
  }
74
79
  }, {