{"id":16286,"library":"acme-http-01-standalone","title":"ACME HTTP-01 Standalone Challenge Handler","description":"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.","status":"active","version":"3.0.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","standalone","memory","http-01","letsencrypt","acme","greenlock"],"install":[{"cmd":"npm install acme-http-01-standalone","lang":"bash","label":"npm"},{"cmd":"yarn add acme-http-01-standalone","lang":"bash","label":"yarn"},{"cmd":"pnpm add acme-http-01-standalone","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import { create } from 'acme-http-01-standalone';","symbol":"create","correct":"const { create } = require('acme-http-01-standalone');"},{"note":"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.","wrong":"const http01 = require('acme-http-01-standalone');","symbol":"http01 instance","correct":"const http01 = require('acme-http-01-standalone').create({});"},{"note":"Users will need to create their own `d.ts` declaration files or use JSDoc for type inference if working in TypeScript.","symbol":"Type definitions","correct":"Unfortunately, no official type definitions are currently published for this package."}],"quickstart":{"code":"const Greenlock = require('greenlock-express');\nconst { create } = require('acme-http-01-standalone');\n\nconst http01 = create({});\n\n// Minimal Greenlock setup with the custom http-01 challenge handler\nconst greenlock = Greenlock.create({\n  packageRoot: require('path').join(__dirname, '..'),\n  configDir: './greenlock.d/',\n  maintainerEmail: 'webmaster@example.com',\n  cluster: false, // Set to true for production with multiple processes\n  challenges: {\n    'http-01': http01\n  },\n  // For testing, typically you'd also configure a storage solution\n  // storage: require('greenlock-pm').create({\n  //   configDir: './greenlock.d/'\n  // })\n});\n\n// Example of setting an ACME challenge (usually done by Greenlock/ACME.js internally)\nhttp01.set({\n  identifier: { value: 'example.com' },\n  token: 'someRandomTokenString',\n  keyAuthorization: 'someRandomTokenString.keyAuthorizationHash'\n})\n.then(() => {\n  console.log('ACME challenge data saved to in-memory store.');\n  // In a real scenario, an ACME client would now attempt to fetch this\n  // data via HTTP on port 80.\n})\n.catch(err => {\n  console.error('Failed to set ACME challenge data:', err);\n});","lang":"javascript","description":"Demonstrates initializing the standalone HTTP-01 challenge handler and integrating it with Greenlock.js for ACME certificate acquisition, showing a basic challenge `set` operation."},"warnings":[{"fix":"For production or scaled environments, integrate with a challenge solver that supports persistent storage (e.g., file system, database) or ensure external state management for the in-memory store.","message":"This package is explicitly designed for 'in-memory' storage of ACME challenge data. This means any challenge data set will be lost if the Node.js process restarts. It is not suitable for persistent storage or load-balanced environments without an external mechanism to manage state.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Prefer `const { create } = require('acme-http-01-standalone');` in CommonJS projects. In ESM projects, consider dynamic `import()` or bundling tools that handle CommonJS modules.","message":"The package primarily uses CommonJS `require()` exports. While Node.js can often interop between CommonJS and ESM, direct `import { create } from 'acme-http-01-standalone'` might not work as expected in pure ESM projects or require specific Node.js loader configurations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"No direct fix needed, but be aware that certain modern language features or performance optimizations might not be present within the library's core.","message":"The package states 'node v6 compatible VanillaJS'. While this ensures broad compatibility, it means it doesn't leverage newer JavaScript features or Node.js APIs introduced in later versions, which might affect performance or developer experience in modern environments.","severity":"gotcha","affected_versions":"<=3.x"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Change 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');`.","cause":"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).","error":"require is not defined in ES module scope"},{"fix":"Ensure you call `create({})` on the imported module: `const { create } = require('acme-http-01-standalone'); const http01 = create({});`.","cause":"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.","error":"http01.set is not a function"},{"fix":"Verify that `acme-http-01-standalone` is listed in your `package.json` and run `npm install` or `yarn install` to ensure it's properly installed.","cause":"The `acme-http-01-standalone` package could not be found or loaded correctly, often due to a missing `node_modules` entry or incorrect path.","error":"TypeError: Cannot read properties of undefined (reading 'create')"}],"ecosystem":"npm"}