Packages

asn1js

4.1.0 · 19 Nov 2026BSD-3-Clause38.6M / weekRepositoryHomepagenpmAtom feed

Your version

4.0.0

major19 Oct 2026Where it was published

4.1.0 is the newest release of 4.x.

In short

1 breaking1 internal

  • 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.

Release note

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.

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.