npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

acme-sx

v1.1.2

Published

ACME client for Node.js using the ACME protocol to generate certificate management.

Readme

ACME-SX

A lightweight TypeScript ACME client for issuing and storing TLS certificates via Let's Encrypt.

It supports:

  • Managed mode: this package starts an HTTP challenge server for you.
  • Self-hosted mode: you provide the challenge directory and serve files yourself.
  • PEM → PFX conversion: convert generated PEM certificate/key files into a .pfx bundle.

Features

  • ACME account creation/reuse
  • Automatic CSR generation
  • HTTP-01 challenge handling
  • Certificate + private key storage
  • PEM to PFX conversion (convertToPFX)
  • Typed event system for logs/errors
  • TypeScript-first API

Installation

npm install acme-sx

For local development in this repository:

npm install

Quick Start

1) Import and create a client

import {
  ACMEClientSX,
  HOSTED_TYPE,
  ACMEEvents,
  ACMEEvent,
  IssueCertificateOptions,
  ACMEResponse,
  ACMEStoreResult
} from "acme-sx";
// local dev alternative: from "./src/main"

2) Optional: subscribe to events

ACMEEvents.on("log", (event: ACMEEvent<"log">) => {
  console.log(`[${event.timestamp.toISOString()}] ${event.message}`);
});

ACMEEvents.on("error", (event: ACMEEvent<"error">) => {
  console.error(`[${event.timestamp.toISOString()}] ${event.message}`);
});

3) Initialize client

Managed mode (package serves /.well-known/acme-challenge itself)

const client = new ACMEClientSX({
  staging: true, // use Let's Encrypt staging for tests
  hosted: HOSTED_TYPE.MANAGED
});

Self-hosted mode (you serve challenge files)

const client = new ACMEClientSX({
  staging: true,
  hosted: HOSTED_TYPE.SELF,
  challengeDirectory: "/var/www/.well-known/acme-challenge"
});

4) Test challenge reachability

const reachability = await client.testChallengeReachability("example.com");
console.log(reachability);

5) Issue certificate

const options: IssueCertificateOptions = {
  email: "[email protected]",
  domain: "example.com",
  certificateStorePath: "./certificates",
  agreedTermsOfService: true,
  challengeType: "http-01"
};

const result: ACMEResponse<ACMEStoreResult> = await client.issueCertificate(options);

if (result.success) {
  console.log("Certificate stored:", result.data);
} else {
  console.error("Issuing failed:", result.error);
}

6) Convert PEM certificate/key to PFX

const pfxResult: ACMEResponse<string> = await ACMEClientSX.convertToPFX({
  certPemPath: "./certificates/example.com-cert.pem",
  keyPemPath: "./certificates/example.com-key.pem",
  domain: "example.com",
  passphrase: "change-me"
});

if (pfxResult.success) {
  console.log("PFX created at:", pfxResult.data);
} else {
  console.error("PFX conversion failed:", pfxResult.error);
}

API Overview

new ACMEClientSX(options)

options:

  • staging?: boolean (default: false)
  • hosted: HOSTED_TYPE.MANAGED | HOSTED_TYPE.SELF
  • challengeDirectory: string (required for SELF)

testChallengeReachability(domain: string)

Checks whether the HTTP challenge endpoint is publicly reachable and returns ACMEResponse.

issueCertificate(options: IssueCertificateOptions)

Issues a certificate and stores:

  • ${domain}-cert.pem
  • ${domain}-key.pem
  • account-key.pem (for account reuse)

Returns ACMEResponse<ACMEStoreResult>.

ACMEClientSX.convertToPFX(options)

Converts existing PEM certificate/key files into a PFX file.

options:

  • certPemPath: string – path to certificate PEM
  • keyPemPath: string – path to private key PEM
  • domain: string – used for output naming
  • passphrase: string – password for resulting PFX

Returns ACMEResponse<string> where data is the created PFX path.


Important Notes

  • Port 80 is required for HTTP-01 challenge.
  • Your domain must resolve to the machine running this flow.
  • Use staging: true while testing to avoid Let's Encrypt rate limits.
  • In managed mode, the package uses a local ./acme-challenges directory.
  • Store your PFX passphrase securely (e.g., environment variables / secrets manager).

License

MIT