Socket
Socket
Sign inDemoInstall

@lapo/asn1js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lapo/asn1js - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

defs.js

21

package.json
{
"name": "@lapo/asn1js",
"version": "2.0.2",
"version": "2.0.3",
"description": "Generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.",

@@ -16,6 +16,7 @@ "type": "module",

"homepage": "https://lapo.it/asn1js/",
"files": [ "asn1.js", "base64.js", "hex.js", "int10.js", "oids.js" ],
"files": [ "asn1.js", "base64.js", "hex.js", "int10.js", "defs.js", "oids.js", "rfcdef.js" ],
"scripts": {
"lint": "npx eslint asn1.js base64.js hex.js int10.js oids.js tags.js context.js index.js parseRFC.js dumpASN1.js test.js testDefs.js",
"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",
"lint-action": "npx @action-validator/cli .github/workflows/node.js.yml",
"build": "vite build",
"serve": "echo 'Connect to http://localhost:3000/' ; npx statik --port 3000 .",

@@ -29,4 +30,16 @@ "test": "node test",

"devDependencies": {
"eslint": "^8.34.0"
"eslint": "^8.34.0",
"htmlparser2": "^9.1.0",
"vite": "^5.2.10",
"vite-plugin-dom": "^1.0.3",
"vite-plugin-singlefile": "^2.0.1"
},
"overrides": {
"rollup": "npm:@rollup/wasm-node"
},
"pnpm": {
"overrides": {
"rollup": "npm:@rollup/wasm-node"
}
},
"eslintConfig": {

@@ -33,0 +46,0 @@ "env": {

34

README.md

@@ -8,4 +8,4 @@ asn1js

Usage with `npm` / `yarn`
-------------------------
Usage with `nodejs`
-------------------

@@ -21,6 +21,6 @@ This package can be installed with either npm or yarn via the following commands:

Assuming a standard javascript bundler is setup you can import it like so:
You can import the classes like this:
```js
import ASN1 from '@lapo/asn1js';
import { ASN1 } from '@lapo/asn1js';
```

@@ -31,7 +31,26 @@

```js
import Hex from '@lapo/asn1js/hex';
import { Hex } from '@lapo/asn1js/hex.js';
```
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.
If your code is still not using ES6 Modules (and is using CommonJS) you can `require` it normally [since NodeJS 22](https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/) (with parameter `--experimental-require-module`):
```js
const
{ ASN1 } = require('@lapo/asn1js'),
{ Hex } = require('@lapo/asn1js/hex.js');
console.log(ASN1.decode(Hex.decode('06032B6570')).content());
```
On older NodeJS you instead need to use async `import`:
```js
async function main() {
const
{ ASN1 } = await import('@lapo/asn1js'),
{ Hex } = await import('@lapo/asn1js/hex.js');
console.log(ASN1.decode(Hex.decode('06032B6570')).content());
}
main();
```
Usage on the web

@@ -44,3 +63,3 @@ --------------------

<script>
import { ASN1} from 'https://unpkg.com/@lapo/asn1js@2.0.0/asn1.js';
import { ASN1 } from 'https://unpkg.com/@lapo/asn1js@2.0.0/asn1.js';
import { Hex } from 'https://unpkg.com/@lapo/asn1js@2.0.0/hex.js';

@@ -77,4 +96,5 @@

- [dedicated domain](https://asn1js.eu/)
- [single-file version working locally](https://asn1js.eu/index-local.html) (just save this link)
- [InDefero tracker](http://idf.lapo.it/p/asn1js/)
- [GitHub mirror](https://github.com/lapo-luchini/asn1js)
- [Ohloh code stats](https://www.openhub.net/p/asn1js)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc