ACME HTTP-01 Standalone Challenge Handler

3.0.5 · active · verified Wed Apr 22

This package provides a lightweight, in-memory HTTP-01 challenge handler for ACME (Automated Certificate Management Environment) clients in Node.js, primarily designed for use with Let's Encrypt. Compatible with ACME.js and Greenlock.js, it specifically addresses the `http-01` challenge type required for domain validation. Currently at version 3.0.5, it emphasizes simplicity and embeddability, featuring zero external dependencies and a minimal codebase (under 150 lines). Its key differentiators include the ability to operate standalone without a dedicated web server and its entirely in-memory operation, making it suitable for quick setups or testing environments. The package is built with Node.js v6 compatibility in mind, offering broad support, though primarily exports CommonJS modules.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing the standalone HTTP-01 challenge handler and integrating it with Greenlock.js for ACME certificate acquisition, showing a basic challenge `set` operation.

const Greenlock = require('greenlock-express');
const { create } = require('acme-http-01-standalone');

const http01 = create({});

// Minimal Greenlock setup with the custom http-01 challenge handler
const greenlock = Greenlock.create({
  packageRoot: require('path').join(__dirname, '..'),
  configDir: './greenlock.d/',
  maintainerEmail: 'webmaster@example.com',
  cluster: false, // Set to true for production with multiple processes
  challenges: {
    'http-01': http01
  },
  // For testing, typically you'd also configure a storage solution
  // storage: require('greenlock-pm').create({
  //   configDir: './greenlock.d/'
  // })
});

// Example of setting an ACME challenge (usually done by Greenlock/ACME.js internally)
http01.set({
  identifier: { value: 'example.com' },
  token: 'someRandomTokenString',
  keyAuthorization: 'someRandomTokenString.keyAuthorizationHash'
})
.then(() => {
  console.log('ACME challenge data saved to in-memory store.');
  // In a real scenario, an ACME client would now attempt to fetch this
  // data via HTTP on port 80.
})
.catch(err => {
  console.error('Failed to set ACME challenge data:', err);
});

view raw JSON →