Packages

@peculiar/x509

3.1.0 · 27 Oct 2026MIT24.9M / weekRepositoryHomepagenpmAtom feed

Your version

3.0.0

major27 Oct 2026Where it was published

3.1.0 is the newest release of 3.x.

Summary· from the note as AI read it

Migration neededRead before upgrading: 4 changes to make.

Before you upgrade

  • DER/BER input with trailing bytes now throws; strip extra data before parsing
  • DER input with trailing data is now rejected; check parsed inputs

New minimums

  • ESM-only; use Node ^20.19 or >=22.12; replace removed build files and deep imports
  • ESM-only output; upgrade Node to ^20.19.0 or >=22.12.0

In short

4 breaking

  • Breaking

    DER/BER input that continues after the encoded structure throws "Unexpected data after the ASN.1 structure: <n> trailing bytes" instead of being accepted with the extra bytes kept in rawData.

  • Breaking

    @peculiar/x509 is ESM-only and requires Node.js ^20.19.0 || >=22.12.0 (was >=20.0.0). CommonJS code can still require("@peculiar/x509") on these versions through require(esm); Node.js 20.0-20.18 and 22.0-22.11 can't. build/x509.cjs.js and build/x509.es.js are replaced by build/index.js, and deep imports are blocked by "exports". TypeScript projects compiling to CommonJS need "module": "node20" or "nodenext" (node16 fails with TS1479). build/x509.js (the browser script with the x509 global) and the unpkg/jsdelivr fields are removed; browsers use the ESM build through a bundler or esm.sh, or pin

  • Breaking

    reject trailing data after DER-encoded input

  • Breaking

    ship ESM-only output for Node.js ^20.19.0 || >=22.12.0

Release note

Breaking changes

  • Breaking

    DER/BER input that continues after the encoded structure throws "Unexpected data after the ASN.1 structure: <n> trailing bytes" instead of being accepted with the extra bytes kept in rawData.

  • Breaking

    @peculiar/x509 is ESM-only and requires Node.js ^20.19.0 || >=22.12.0 (was >=20.0.0). CommonJS code can still require("@peculiar/x509") on these versions through require(esm); Node.js 20.0-20.18 and 22.0-22.11 can't. build/x509.cjs.js and build/x509.es.js are replaced by build/index.js, and deep imports are blocked by "exports". TypeScript projects compiling to CommonJS need "module": "node20" or "nodenext" (node16 fails with TS1479). build/x509.js (the browser script with the x509 global) and the unpkg/jsdelivr fields are removed; browsers use the ESM build through a bundler or esm.sh, or pin @peculiar/x509@2 for the old script. @peculiar/asn1-schema ^3.0.0 is a peer dependency and the @peculiar/asn1-* dependencies move to 3 (asn1js 4), so ASN.1 objects from asn1-schema 2 packages can't be passed in. pvtsutils is replaced by @peculiar/utils 4. The public API is unchanged and the Reflect polyfill is still required. See "Breaking Changes In v3" in the README.

Bug Fixes

  • Reject trailing data after DER-encoded input

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.