@push.rocks/smartacme 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/package.json +1 -1
- package/readme.md +70 -5
- package/ts/00_commitinfo_data.ts +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartacme',
|
|
6
|
-
version: '6.
|
|
6
|
+
version: '6.1.0',
|
|
7
7
|
description: 'A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx1QkFBdUI7SUFDN0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDZHQUE2RztDQUMzSCxDQUFBIn0=
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -138,8 +138,76 @@ async function main() {
|
|
|
138
138
|
await smartAcmeInstance.stop();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
main().catch(console.error);
|
|
142
|
-
```
|
|
141
|
+
main().catch(console.error);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Built-in Challenge Handlers
|
|
145
|
+
|
|
146
|
+
This module includes two out-of-the-box ACME challenge handlers:
|
|
147
|
+
|
|
148
|
+
- **Dns01Handler**
|
|
149
|
+
- Uses a Cloudflare account (from `@apiclient.xyz/cloudflare`) and Smartdns client to set and remove DNS TXT records, then wait for propagation.
|
|
150
|
+
- Import path:
|
|
151
|
+
```typescript
|
|
152
|
+
import { Dns01Handler } from '@push.rocks/smartacme/ts/handlers/Dns01Handler.js';
|
|
153
|
+
```
|
|
154
|
+
- Example:
|
|
155
|
+
```typescript
|
|
156
|
+
import * as cloudflare from '@apiclient.xyz/cloudflare';
|
|
157
|
+
const cfAccount = new cloudflare.CloudflareAccount('CF_TOKEN');
|
|
158
|
+
const dnsHandler = new Dns01Handler(cfAccount);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- **Http01Handler**
|
|
162
|
+
- Writes ACME HTTP-01 challenge files under a file-system webroot (`/.well-known/acme-challenge/`), and removes them on cleanup.
|
|
163
|
+
- Import path:
|
|
164
|
+
```typescript
|
|
165
|
+
import { Http01Handler } from '@push.rocks/smartacme/ts/handlers/Http01Handler.js';
|
|
166
|
+
```
|
|
167
|
+
- Example:
|
|
168
|
+
```typescript
|
|
169
|
+
const httpHandler = new Http01Handler({ webroot: '/var/www/html' });
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Both handlers implement the `IChallengeHandler<T>` interface and can be combined in the `challengeHandlers` array.
|
|
173
|
+
|
|
174
|
+
## Creating Custom Handlers
|
|
175
|
+
|
|
176
|
+
To support additional challenge types or custom validation flows, implement the `IChallengeHandler<T>` interface:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import type { IChallengeHandler } from '@push.rocks/smartacme/ts/handlers/IChallengeHandler.js';
|
|
180
|
+
|
|
181
|
+
// Define your custom challenge payload type
|
|
182
|
+
interface MyChallenge { type: string; /* ... */ }
|
|
183
|
+
|
|
184
|
+
class MyCustomHandler implements IChallengeHandler<MyChallenge> {
|
|
185
|
+
getSupportedTypes(): string[] {
|
|
186
|
+
return ['my-01'];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Prepare the challenge (set DNS records, start servers, etc.)
|
|
190
|
+
async prepare(ch: MyChallenge): Promise<void> {
|
|
191
|
+
// preparation logic
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Optional verify step after prepare
|
|
195
|
+
async verify?(ch: MyChallenge): Promise<void> {
|
|
196
|
+
// verification logic
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Cleanup after challenge (remove records, stop servers)
|
|
200
|
+
async cleanup(ch: MyChallenge): Promise<void> {
|
|
201
|
+
// cleanup logic
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Then register your handler:
|
|
206
|
+
const customInstance = new SmartAcme({
|
|
207
|
+
/* other options */,
|
|
208
|
+
challengeHandlers: [ new MyCustomHandler() ],
|
|
209
|
+
challengePriority: ['my-01'],
|
|
210
|
+
});
|
|
143
211
|
|
|
144
212
|
In this example, `Qenv` is used to manage environment variables, and `cloudflare` library is used to handle DNS challenges required by Let's Encrypt ACME protocol. The `setChallenge` and `removeChallenge` methods are essential for automating the DNS challenge process, which is a key part of domain validation.
|
|
145
213
|
|
|
@@ -237,8 +305,6 @@ This comprehensive guide ensures you can set up, manage, and test ACME certifica
|
|
|
237
305
|
|
|
238
306
|
---
|
|
239
307
|
|
|
240
|
-
```
|
|
241
|
-
|
|
242
308
|
## License and Legal Information
|
|
243
309
|
|
|
244
310
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
|
@@ -257,4 +323,3 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
|
|
257
323
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
258
324
|
|
|
259
325
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
260
|
-
```
|
package/ts/00_commitinfo_data.ts
CHANGED