ASN.1 DER Encoder/Decoder and DSL for Node.js with no dependencies
Installations
npm install @panva/asn1.js
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=10.13.0
Node Version
12.13.0
NPM Version
6.13.7
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
panva
Download Statistics
Total Downloads
275,127,902
Last Day
139,501
Last Week
625,836
Last Month
2,887,078
Last Year
46,597,818
GitHub Statistics
3 Stars
237 Commits
1 Forks
3 Watching
3 Branches
1 Contributors
Bundle Size
24.10 kB
Minified
7.16 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
@panva/asn1.js@1.0.0
Size
12.69 kB
NPM Version
6.13.7
Node Version
12.13.0
Publised On
18 Feb 2020
Total Downloads
Cumulative downloads
Total Downloads
275,127,902
Last day
-8.7%
139,501
Compared to previous day
Last week
-18%
625,836
Compared to previous week
Last month
3.4%
2,887,078
Compared to previous month
Last year
-33.1%
46,597,818
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
ASN1.js
ASN.1 DER Encoder/Decoder and DSL for Node.js with no dependencies
Acknowledgement
This is a fork of @indutny's asn.js
library with the following
changes made:
- all
.int()
returns are nativeBigInt
values - lint using
standard
Example
Define model:
1const asn = require('@panva/asn1.js') 2 3const Human = asn.define('Human', function () { 4 this.seq().obj( 5 this.key('firstName').octstr(), 6 this.key('lastName').octstr(), 7 this.key('age').int(), 8 this.key('gender').enum({ 0: 'male', 1: 'female' }), 9 this.key('bio').seqof(Bio) 10 ) 11}) 12 13const Bio = asn.define('Bio', function () { 14 this.seq().obj( 15 this.key('time').gentime(), 16 this.key('description').octstr() 17 ) 18})
Encode data:
1const output = Human.encode({ 2 firstName: 'Thomas', 3 lastName: 'Anderson', 4 age: 28, 5 gender: 'male', 6 bio: [ 7 { 8 time: new Date('31 March 1999').getTime(), 9 description: 'freedom of mind' 10 } 11 ] 12}, 'der')
Decode data:
1const human = Human.decode(output, 'der') 2console.log(human) 3/* 4{ firstName: <Buffer 54 68 6f 6d 61 73>, 5 lastName: <Buffer 41 6e 64 65 72 73 6f 6e>, 6 age: 28n, 7 gender: 'male', 8 bio: 9 [ { time: 922820400000, 10 description: <Buffer 66 72 65 65 64 6f 6d 20 6f 66 20 6d 69 6e 64> } ] } 11*/
Partial decode
Its possible to parse data without stopping on first error. In order to do it, you should call:
1const human = Human.decode(output, 'der', { partial: true }) 2console.log(human) 3/* 4{ result: { ... }, 5 errors: [ ... ] } 6*/
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
5 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/panva/asn1.js/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/panva/asn1.js/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/panva/asn1.js/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/panva/asn1.js/test.yml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More