asn1js
4.1.0 · 19 Nov 2026BSD-3-Clause38.6M / weekRepositoryHomepagenpmAtom feed
46 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 4.x · latest line
4.1.0
19 Nov 2026der: add strict DER decoding and validation helpers
oid: add opt-in strict validation and encoding
boolean: print the value in toString()
Features
der: add strict DER decoding and validation helpers
oid: add opt-in strict validation and encoding
Bug Fixes
boolean: print the value in toString()
oid: optimize base-128 encoding of large components
oid: preserve exact values and validate complete strings
4.0.0
19 Oct 2026- Breaking
asn1js is ESM-only and requires Node.js ^20.19.0 || >=22.12.0 (previously >=12.0.0), so Node.js versions below 20.19 and 22.0-22.11 are no longer supported. The CommonJS build is removed: build/index.js (CommonJS) and build/index.es.js are replaced by a single ES module, build/index.js, with build/index.d.ts, and the new exports map blocks deep imports into build/. CommonJS code can still require("asn1js") on supported Node.js versions through require(esm). TypeScript projects that compile to CommonJS need "module": "node20" or "nodenext". pvtsutils and pvutils are replaced by @peculiar/utils ^4.1. The exported API is unchanged, but new Integer({ value }) and the valueDec setter throw a RangeError for non-integer numbers (v3 truncated them), and encoding a UTCTime with a year outside 1950-2049 throws a RangeError, including new UTCTime({ valueDate }) (v3 wrapped 2050 to 1950; use GeneralizedTime). Integer.fromBigInt encodes negative values correctly, UniversalString encodes characters outside the BMP as single UCS-4 code points (v3 wrote surrogate pairs, which still decode), OID arcs and tag numbers from 2^49 to 2^53 now encode, and an odd-length BMPString or a UniversalString whose length isn't a multiple of 4 returns a decode error instead of throwing. Libraries that check instanceof against asn1js classes (pkijs, @peculiar/asn1-schema) must use the same asn1js major as the application. See "Breaking Changes In v4" in the README.
Breaking changes
- Breaking
asn1js is ESM-only and requires Node.js ^20.19.0 || >=22.12.0 (previously >=12.0.0), so Node.js versions below 20.19 and 22.0-22.11 are no longer supported. The CommonJS build is removed: build/index.js (CommonJS) and build/index.es.js are replaced by a single ES module, build/index.js, with build/index.d.ts, and the new exports map blocks deep imports into build/. CommonJS code can still require("asn1js") on supported Node.js versions through require(esm). TypeScript projects that compile to CommonJS need "module": "node20" or "nodenext". pvtsutils and pvutils are replaced by @peculiar/utils ^4.1. The exported API is unchanged, but new Integer({ value }) and the valueDec setter throw a RangeError for non-integer numbers (v3 truncated them), and encoding a UTCTime with a year outside 1950-2049 throws a RangeError, including new UTCTime({ valueDate }) (v3 wrapped 2050 to 1950; use GeneralizedTime). Integer.fromBigInt encodes negative values correctly, UniversalString encodes characters outside the BMP as single UCS-4 code points (v3 wrote surrogate pairs, which still decode), OID arcs and tag numbers from 2^49 to 2^53 now encode, and an odd-length BMPString or a UniversalString whose length isn't a multiple of 4 returns a decode error instead of throwing. Libraries that check instanceof against asn1js classes (pkijs, @peculiar/asn1-schema) must use the same asn1js major as the application. See "Breaking Changes In v4" in the README.
- 3.x
3.1.0
16 Oct 2026Migrate test runner from Jest to Vitest
Migrate eslint to oxlint, oxfmt
build: Exclude tests from production type checking
What's Changed
Migrate test runner from Jest to Vitest
Migrate eslint to oxlint, oxfmt
build: Exclude tests from production type checking
GeneralizedTime: Omit trailing zeros in fractional seconds (DER)
Reduce ASN.1 parsing and BER encoding allocations
3.0.10
20 Apr 2026Added parser limits to
asn1js.fromBER()to prevent unbounded BER parsing.Optimized long-form ASN.1 tag parsing to avoid quadratic buffer growth.
3.0.9
20 Apr 20263.0.7
9 Dec 2025Update website GitHub Actions and package dependencies
Fixed Example to only use asn1js
Migrate from Yarn to npm for dependency management
What's Changed
Update website GitHub Actions and package dependencies
Fixed Example to only use asn1js
Migrate from Yarn to npm for dependency management
Empty bitstring ber encoding output should be 0x030100
- 2.x
2.0.10 – 2.4.023 releases without a noteShow each
- 2.4.026 Apr 2022no note
- 2.3.325 Apr 2022no note
- 2.3.220 Mar 2022no note
- 2.3.118 Mar 2022no note
- 2.3.018 Mar 2022no note
- 2.2.023 Dec 2021no note
- 2.1.122 Mar 2021no note
- 2.1.017 Mar 2021no note
- 2.0.261 Aug 2019no note
- 2.0.2531 Jul 2019no note
- 2.0.2431 Jul 2019no note
- 2.0.2224 Feb 2019no note
- 2.0.212 Jun 2018no note
- 2.0.2014 May 2018no note
- 2.0.1928 Mar 2018no note
- 2.0.1816 Feb 2018no note
- 2.0.1715 Feb 2018no note
- 2.0.1615 Feb 2018no note
- 2.0.1520 Jun 2017no note
- 2.0.1430 May 2017no note
- 2.0.1324 Apr 2017no note
- 2.0.1217 Jan 2017no note
- 2.0.106 Jan 2017no note
- 1.x
1.2.2
7 Jul 2015Fixed bug with zero-length OCTETSTRING
1.0.2
18 Feb 2015Append information about how to use ASN1.js in Node.js environment
1.0.1
16 Jul 2014
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.