unstale

npm / asn1js

asn1js

What changed in asn1js 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.

10 breaking1 security2 performance1 behavior and defaults3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.1 on npm

asn1js 412 changes

Breaking changes 10

  • Libraries that check instanceof against asn1js classes must use the same asn1js major version as the application.

    4.0.0release notes

  • Decoding an odd-length BMPString or a UniversalString whose length is not a multiple of 4 returns a decode error instead of throwing.

    4.0.0release notes

  • The new exports map blocks deep imports into build/.

    4.0.0release notes

  • The package ships a single ES module; CommonJS code can still use require("asn1js") on supported Node.js versions through require(esm).

    4.0.0release notes

  • Constructing an Integer with a non-integer number now throws RangeError instead of truncating the value.

    4.0.0release notes

  • TypeScript projects that compile to CommonJS need to use node20 or nodenext.

    4.0.0release notes

  • The minimum supported versions are ^20.19.0 or >=22.12.0; older Node.js versions are no longer supported.

    4.0.0release notes

  • Characters outside the BMP are encoded as single UCS-4 code points instead of surrogate pairs.

    4.0.0release notes

  • Encoding a year outside 1950–2049 now throws RangeError, including when constructed with valueDate; use GeneralizedTime instead.

    4.0.0release notes

  • Setting valueDec to a non-integer number now throws RangeError instead of truncating the value.

    4.0.0release notes

Behavior and default changes 1

  • Values from 2^49 to 2^53 can now be encoded for OID arcs and tag numbers.

    4.0.0release notes

Fixes and other changes 1

  • Negative BigInt values are now encoded correctly.

    4.0.0release notes

asn1js 35 changes

Security 1

  • Added parser limits to prevent unbounded BER parsing.

    3.0.10release notes

Performance 2

  • Parsing and BER encoding reduce allocations.

    3.1.0release notes

  • Optimized parsing to avoid quadratic buffer growth.

    3.0.10release notes

Fixes and other changes 2

  • DER fractional seconds omit trailing zeros.

    3.1.0release notes

  • Fixes BER encoding of an empty bitstring so the output is 0x030100.

    3.0.7release notes