https://github.com/firsttimeez/acme
Automatically Create and Renew LetsEncrypt! SSL Certificates, including Wildcard Certificates for supported DNS Providers
https://github.com/firsttimeez/acme
acme acme-ari acme-v2 certificate daemon dns-01 encrypt es6-class es6-javascript es6-module http-01 lets lets-encrypt mixin nodejs npm renewal wildcard wildcard-certificates
Last synced: 7 months ago
JSON representation
Automatically Create and Renew LetsEncrypt! SSL Certificates, including Wildcard Certificates for supported DNS Providers
- Host: GitHub
- URL: https://github.com/firsttimeez/acme
- Owner: FirstTimeEZ
- License: apache-2.0
- Created: 2024-12-08T08:28:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-20T03:41:24.000Z (over 1 year ago)
- Last Synced: 2025-08-09T09:49:55.421Z (8 months ago)
- Topics: acme, acme-ari, acme-v2, certificate, daemon, dns-01, encrypt, es6-class, es6-javascript, es6-module, http-01, lets, lets-encrypt, mixin, nodejs, npm, renewal, wildcard, wildcard-certificates
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/lets-encrypt-acme-client
- Size: 113 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LetsEncrypt! ACME Client
Automatically Create and Renew `LetsEncrypt! SSL Certificates`, including `Wildcard Certificates` for supported `DNS Providers`
### Getting Started
```javascript
import LetsEncryptDaemon from 'lets-encrypt-acme-client';
```
#### Simple Usage Example
Create a `LetsEncryptDaemon` and then start the `Daemon`
```javascript
const daemon = new LetsEncryptDaemon();
await daemon.startLetsEncryptDaemon(...); // You can only start this once, it will configure itself to run again.
daemon.checkChallengesMixin(...); // You must check the HTTP-01 Challenges for each LetsEncryptDaemon
```
#### Complete Example Usage
This most recent version of this package is implemented in [`SSL Server`](https://github.com/FirstTimeEZ/server-ssl)
You can use [`SSL Server`](https://github.com/FirstTimeEZ/server-ssl) to understand how it works if the `jsdoc` isn't enough information.
--------
### Wild Card Certificates
| Supported DNS Providers |
|-------------------------|
| Cloud Flare |
You can generate `Wild Card Certificates` if you are using a supported `DNS Provider`
```
let dnsProvider = {
name: "Cloud Flare",
token: "apiTokenWithDnsEditPermission",
zone: "zoneId" // optional if it cant be found automatically.
}
```
`DNS Providers` are used to complete `DNS-01` challenges
--------
### LetsEncrypt! Daemon
`LetsEncryptDaemon` is the default exported class
```javascript
const daemon = new LetsEncryptDaemon();
```
### Daemon
The `Daemon` runs periodically to `Create` or `Renew` the `Certificate`
### Jsdoc
```javascript
/**
* Starts the LetsEncrypt! Daemon to Manage a SSL Certificate
*
* @param {Array} fqdns - The fully qualified domain names as a SAN (e.g., ["example.com", "www.example.com"]), You must use a `dnsProvider` if you include a wild card
* @param {string} sslPath - The path where your acme account, keys and generated certificate will be stored or loaded from
* @param {function} certificateCallback - Callback that can be used to update the current certificate or trigger a restart etc.
* @param {boolean} [optGenerateAnyway=false] - (optional) True to generate a new certificate before the recommended time.
* @param {boolean} [optStaging=false] - (optional) True to use staging mode instead of production.
*
* @param {Object} dnsProvider - (optional) credentials for a supported dns provider if you want to use the `DNS-01` Challenge instead of `HTTP-01`
* @example
* const dnsProvider = {
* name: "Cloud Flare",
* token: "dnsEditPermissionApiToken",
* //zone: "zoneId", // if it cant be found automatically
* }
* @note
* If you start this more than once nothing will happen
*/
```
#### Usage
```javascript
await daemon.startLetsEncryptDaemon(fqdns, sslPath, certificateCallback, optGenerateAnyway = false, optStaging = false, dnsProvider = undefined)
```
### HTTP Mixin for `HTTP-01`
`HTTP Mixin` that completes the `HTTP-01` Challenges created by the `Daemon`
This is not required if you are using a `DNS Provider`
### Jsdoc
```javascript
/**
* Node.js Middleware function to check and respond to ACME HTTP-01 challenges issued by this LetsEncryptDaemon inside the HTTP Server.
*
* @example
* createServerHTTP(async (req, res) => {
* if (STATE.optLetsEncrypt && checkChallengesMixin(req, res)) { return; }
* // normal request redirect etc
* }).listen(80);
*/
```
#### Usage
```javascript
if (daemon.checkChallengesMixin(req, res)) { return; } // Inside the HTTP Server
```
--------
### Challenges
The `DNS-01` and `HTTP-01` challenges have been implemented