Registry /
auth-security / acme-http-01-standalone
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.
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
create
✓ const { create } = require('acme-http-01-standalone');
✗ import { create } from 'acme-http-01-standalone';
The package primarily uses CommonJS `module.exports`, although modern Node.js might transpile `import` statements. For strict ESM environments, dynamic `import()` or a CommonJS wrapper might be necessary.
http01 instance
✓ const http01 = require('acme-http-01-standalone').create({});
✗ const http01 = require('acme-http-01-standalone');
The module exports an object with a `create` method; calling `create()` is necessary to get the challenge handler instance with `set`, `get`, and `remove` methods.
Type definitions
✓ Unfortunately, no official type definitions are currently published for this package.
Users will need to create their own `d.ts` declaration files or use JSDoc for type inference if working in TypeScript.
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);
});
Errors
Common errors & fixes
require is not defined in ES module scope
Attempting to use `require()` in a JavaScript file that Node.js treats as an ES module (e.g., due to `"type": "module"` in `package.json` or a `.mjs` extension).
fixChange the file to a CommonJS module (e.g., rename to `.js` and remove `"type": "module"`), or use dynamic `import()`: `const { create } = await import('acme-http-01-standalone');`. http01.set is not a function
The `create` method was not called, or the module was imported incorrectly, leading to `http01` not being the challenge handler instance but rather the module's export object.
fixEnsure you call `create({})` on the imported module: `const { create } = require('acme-http-01-standalone'); const http01 = create({});`. TypeError: Cannot read properties of undefined (reading 'create')
The `acme-http-01-standalone` package could not be found or loaded correctly, often due to a missing `node_modules` entry or incorrect path.
fixVerify that `acme-http-01-standalone` is listed in your `package.json` and run `npm install` or `yarn install` to ensure it's properly installed.
Audit
Dependencies
No dependency data recorded yet.