selfsigned
5.5.0 · 12 Jan 2026MIT23.1M / weekRepositoryHomepagenpmAtom feed
5.5.0 is the newest release of 5.x.
In short
3 breaking1 removed3 security6 new2 fixed11 changed8 internal
- Breaking
Async-only API: The
generate()function now returns a Promise. Synchronous generation has been removed. - Breaking
No callback support: Callbacks have been completely removed in favor of Promises.
- Breaking
Minimum Node.js version: Now requires Node.js >= 15.6.0 (was >= 10)
- Removed
❌ Removed:
node-forge(1.64 MB) - Security
Now uses Node.js native WebCrypto API instead of JavaScript implementation
- Security
Better integration with platform security features
- Security
More secure random number generation
Release note
Major Rewrite
Complete rewrite replacing node-forge with modern @peculiar/x509 and pkijs libraries.
Added
Native WebCrypto API support for better performance and security
TypeScript examples in documentation
Async/await support as the primary API
Support for
keyPairoption to use existing keysUpdated to use Node.js native crypto for all operations
Separate
selfsigned/pkcs7module for tree-shakeable PKCS#7 support
Breaking changes
- Breaking
Async-only API: The
generate()function now returns a Promise. Synchronous generation has been removed.// Old (v4.x) const pems = selfsigned.generate(attrs, options); // New (v5.x) const pems = await selfsigned.generate(attrs, options);
- Breaking
No callback support: Callbacks have been completely removed in favor of Promises.
// Old (v4.x) selfsigned.generate(attrs, options, function(err, pems) { ... }); // New (v5.x) const pems = await selfsigned.generate(attrs, options); - Breaking
Minimum Node.js version: Now requires Node.js >= 15.6.0 (was >= 10)
Required for native WebCrypto support
- Breaking
Dependencies changed:
❌ Removed:
node-forge(1.64 MB)✅ Added:
@peculiar/x509(551 KB) - 66% smaller!✅ Added:
pkijs(1.94 MB, only for PKCS#7 support)Bundle size reduced by 66% when not using PKCS#7
- Breaking
PKCS#7 API changed:
Old:
const pems = await generate(attrs, { pkcs7: true }); pems.pkcs7New:
const { createPkcs7 } = require('selfsigned/pkcs7'); const pkcs7 = createPkcs7(pems.cert);PKCS#7 is now a separate module for better tree-shaking
Changed
Default key size remains 2048 bits (was incorrectly documented as 1024)
PEM output uses
\nline endings (was\r\n)Private keys now use PKCS#8 format (
BEGIN PRIVATE KEYinstead ofBEGIN RSA PRIVATE KEY)Certificate generation is now fully async using native WebCrypto
PKCS#7 is now tree-shakeable: Moved to separate
selfsigned/pkcs7module so bundlers can exclude it when not used
Fixed
Default key size documentation corrected from 1024 to 2048 bits
Improved error handling for certificate generation failures
Dependencies
Removed:
Added:
Security
- Security
Now uses Node.js native WebCrypto API instead of JavaScript implementation
- Security
Better integration with platform security features
- Security
More secure random number generation
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.