Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0e6bbc5be6 | |||
10511b4293 | |||
d456876de7 | |||
fe495a5f03 |
13
changelog.md
13
changelog.md
@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-05-05 - 7.3.0 - feat(index)
|
||||||
|
Bump @tsclass/tsclass to 9.2.0 and update module exports to include handlers
|
||||||
|
|
||||||
|
- Upgrade @tsclass/tsclass dependency from 9.1.0 to 9.2.0 in package.json
|
||||||
|
- Add explicit export of handlers in ts/index.ts to improve module accessibility
|
||||||
|
|
||||||
|
## 2025-05-05 - 7.2.5 - fix(smartacme)
|
||||||
|
Refactor module exports and update wildcard certificate support documentation
|
||||||
|
|
||||||
|
- Updated readme.plan.md to streamline and remove obsolete wildcard plan details
|
||||||
|
- Normalized certmanager imports by consolidating exports in ts/index.ts and updating tests accordingly
|
||||||
|
- Reordered ISmartAcmeOptions interface properties for clarity (accountEmail moved to the top)
|
||||||
|
|
||||||
## 2025-05-04 - 7.2.4 - fix(test)
|
## 2025-05-04 - 7.2.4 - fix(test)
|
||||||
Refactor wildcard certificate test to properly stub SmartAcme.start and getCertificateForDomain for robust integration.
|
Refactor wildcard certificate test to properly stub SmartAcme.start and getCertificateForDomain for robust integration.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartacme",
|
"name": "@push.rocks/smartacme",
|
||||||
"version": "7.2.4",
|
"version": "7.3.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.",
|
"description": "A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -51,7 +51,7 @@
|
|||||||
"@push.rocks/smartstring": "^4.0.15",
|
"@push.rocks/smartstring": "^4.0.15",
|
||||||
"@push.rocks/smarttime": "^4.1.1",
|
"@push.rocks/smarttime": "^4.1.1",
|
||||||
"@push.rocks/smartunique": "^3.0.9",
|
"@push.rocks/smartunique": "^3.0.9",
|
||||||
"@tsclass/tsclass": "^9.1.0",
|
"@tsclass/tsclass": "^9.2.0",
|
||||||
"acme-client": "^5.4.0"
|
"acme-client": "^5.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@ -45,8 +45,8 @@ importers:
|
|||||||
specifier: ^3.0.9
|
specifier: ^3.0.9
|
||||||
version: 3.0.9
|
version: 3.0.9
|
||||||
'@tsclass/tsclass':
|
'@tsclass/tsclass':
|
||||||
specifier: ^9.1.0
|
specifier: ^9.2.0
|
||||||
version: 9.1.0
|
version: 9.2.0
|
||||||
acme-client:
|
acme-client:
|
||||||
specifier: ^5.4.0
|
specifier: ^5.4.0
|
||||||
version: 5.4.0
|
version: 5.4.0
|
||||||
@ -1342,8 +1342,8 @@ packages:
|
|||||||
'@tsclass/tsclass@8.2.1':
|
'@tsclass/tsclass@8.2.1':
|
||||||
resolution: {integrity: sha512-bRDCfJTipsTcK6eEokWdsOR1mGCQFeM7zTg6PRHzbxTWQcWQD9AhEr2q3CrPcmAbvIS7fvkO6/pU/mPm1MZxhQ==}
|
resolution: {integrity: sha512-bRDCfJTipsTcK6eEokWdsOR1mGCQFeM7zTg6PRHzbxTWQcWQD9AhEr2q3CrPcmAbvIS7fvkO6/pU/mPm1MZxhQ==}
|
||||||
|
|
||||||
'@tsclass/tsclass@9.1.0':
|
'@tsclass/tsclass@9.2.0':
|
||||||
resolution: {integrity: sha512-PkG1bXK/bqVtxaRHje+iJHjtcdRHLHrNTOkzqh+jv2A7mgiyNo2YBJIl4eEJLkw1X3FwEFU4vCAtsegSmJgRug==}
|
resolution: {integrity: sha512-A6ULEkQfYgOnCKQVQRt26O7PRzFo4PE2EoD25RAtnuFuVrNwGynYC20Vee2c8KAOyI7nQ/LaREki9KAX4AHOHQ==}
|
||||||
|
|
||||||
'@types/accepts@1.3.7':
|
'@types/accepts@1.3.7':
|
||||||
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
|
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
|
||||||
@ -4527,7 +4527,7 @@ snapshots:
|
|||||||
'@push.rocks/smartpromise': 4.2.3
|
'@push.rocks/smartpromise': 4.2.3
|
||||||
'@push.rocks/smartrequest': 2.1.0
|
'@push.rocks/smartrequest': 2.1.0
|
||||||
'@push.rocks/smartstring': 4.0.15
|
'@push.rocks/smartstring': 4.0.15
|
||||||
'@tsclass/tsclass': 9.1.0
|
'@tsclass/tsclass': 9.2.0
|
||||||
cloudflare: 4.2.0
|
cloudflare: 4.2.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- encoding
|
- encoding
|
||||||
@ -6848,7 +6848,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
type-fest: 4.40.0
|
type-fest: 4.40.0
|
||||||
|
|
||||||
'@tsclass/tsclass@9.1.0':
|
'@tsclass/tsclass@9.2.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
type-fest: 4.40.1
|
type-fest: 4.40.1
|
||||||
|
|
||||||
|
@ -1,27 +1,3 @@
|
|||||||
# Plan: Add wildcard domain support to SmartAcme
|
## Plan
|
||||||
|
|
||||||
## Goal
|
Move the
|
||||||
- Enable SmartAcme to accept wildcard domain inputs like `*.domain.com` or `*.sub.example.com` and correctly request and match wildcard certificates.
|
|
||||||
|
|
||||||
## Steps
|
|
||||||
1. [x] Extend SmartacmeCertMatcher:
|
|
||||||
- [x] Update `getCertificateDomainNameByDomainName()` to handle wildcard prefixes:
|
|
||||||
- If input starts with `*.` strip the prefix and return the base domain.
|
|
||||||
- For example:
|
|
||||||
- `*.example.com` → `example.com`
|
|
||||||
- `*.sub.example.com` → `sub.example.com`
|
|
||||||
- `*.a.b.example.com` → `a.b.example.com`
|
|
||||||
- [x] Ensure existing logic for non-wildcards remains unchanged.
|
|
||||||
2. [x] Update `SmartAcme.getCertificateForDomain()`:
|
|
||||||
- [x] Detect wildcard inputs (`domainArg.startsWith('*.')`).
|
|
||||||
- [x] For wildcard cases, enforce DNS-01 challenge only (throw error if handlers don't support DNS-01).
|
|
||||||
- [x] Use the matcher result to request wildcard certificate identifiers (e.g., `value: '*.baseDomain'`).
|
|
||||||
3. [x] Update tests:
|
|
||||||
- [x] Add unit tests in `test/test.certmatcher.ts` for wildcard handling:
|
|
||||||
- `*.example.com` → `example.com`
|
|
||||||
- `*.sub.example.com` → `sub.example.com`
|
|
||||||
- `*.a.b.example.com` → `a.b.example.com`
|
|
||||||
- [x] Add integration stub in `test/test.smartacme.ts` for wildcard input in integration mode:
|
|
||||||
- Call `getCertificateForDomain('*.domain.com')` and expect returned cert `domainName` equals `*.domain.com`.
|
|
||||||
4. [x] Update documentation (README.md) if needed.
|
|
||||||
5. [x] Run CI (`pnpm build` & `pnpm test`) and fix any regressions.
|
|
@ -1,7 +1,7 @@
|
|||||||
import { tap, expect } from '@push.rocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
import { Qenv } from '@push.rocks/qenv';
|
import { Qenv } from '@push.rocks/qenv';
|
||||||
import * as cloudflare from '@apiclient.xyz/cloudflare';
|
import * as cloudflare from '@apiclient.xyz/cloudflare';
|
||||||
import { SmartAcme, MongoCertManager, MemoryCertManager } from '../ts/index.js';
|
import { SmartAcme, certmanagers } from '../ts/index.js';
|
||||||
import { Dns01Handler } from '../ts/handlers/Dns01Handler.js';
|
import { Dns01Handler } from '../ts/handlers/Dns01Handler.js';
|
||||||
|
|
||||||
// Load environment variables for credentials (stored under .nogit/)
|
// Load environment variables for credentials (stored under .nogit/)
|
||||||
@ -21,7 +21,7 @@ tap.test('create SmartAcme instance with DNS-01 handler and start', async () =>
|
|||||||
smartAcmeInstance = new SmartAcme({
|
smartAcmeInstance = new SmartAcme({
|
||||||
accountEmail: 'domains@lossless.org',
|
accountEmail: 'domains@lossless.org',
|
||||||
// certManager: new MongoCertManager({ mongoDbName, mongoDbPass, mongoDbUrl }),
|
// certManager: new MongoCertManager({ mongoDbName, mongoDbPass, mongoDbUrl }),
|
||||||
certManager: new MemoryCertManager(),
|
certManager: new certmanagers.MemoryCertManager(),
|
||||||
environment: 'integration',
|
environment: 'integration',
|
||||||
retryOptions: {},
|
retryOptions: {},
|
||||||
challengeHandlers: [new Dns01Handler(cfAccount)],
|
challengeHandlers: [new Dns01Handler(cfAccount)],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { tap, expect } from '@push.rocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
import { SmartAcme, MemoryCertManager } from '../ts/index.js';
|
import { SmartAcme, certmanagers } from '../ts/index.js';
|
||||||
import { Cert } from '../ts/index.js';
|
import { Cert } from '../ts/index.js';
|
||||||
import type { IChallengeHandler } from '../ts/handlers/IChallengeHandler.js';
|
import type { IChallengeHandler } from '../ts/handlers/IChallengeHandler.js';
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ class DummyHandler implements IChallengeHandler<any> {
|
|||||||
tap.test('constructor throws without challengeHandlers', async () => {
|
tap.test('constructor throws without challengeHandlers', async () => {
|
||||||
expect(() => new SmartAcme({
|
expect(() => new SmartAcme({
|
||||||
accountEmail: 'test@example.com',
|
accountEmail: 'test@example.com',
|
||||||
certManager: new MemoryCertManager(),
|
certManager: new certmanagers.MemoryCertManager(),
|
||||||
environment: 'integration',
|
environment: 'integration',
|
||||||
retryOptions: {},
|
retryOptions: {},
|
||||||
} as any)).toThrow();
|
} as any)).toThrow();
|
||||||
@ -22,7 +22,7 @@ tap.test('constructor throws without challengeHandlers', async () => {
|
|||||||
tap.test('constructor accepts valid challengeHandlers', async () => {
|
tap.test('constructor accepts valid challengeHandlers', async () => {
|
||||||
const sa = new SmartAcme({
|
const sa = new SmartAcme({
|
||||||
accountEmail: 'test@example.com',
|
accountEmail: 'test@example.com',
|
||||||
certManager: new MemoryCertManager(),
|
certManager: new certmanagers.MemoryCertManager(),
|
||||||
environment: 'integration',
|
environment: 'integration',
|
||||||
retryOptions: {},
|
retryOptions: {},
|
||||||
challengeHandlers: [new DummyHandler()],
|
challengeHandlers: [new DummyHandler()],
|
||||||
@ -41,7 +41,7 @@ tap.test('get wildcard certificate stub in integration mode', async () => {
|
|||||||
};
|
};
|
||||||
const sa = new SmartAcme({
|
const sa = new SmartAcme({
|
||||||
accountEmail: 'domains@lossless.org',
|
accountEmail: 'domains@lossless.org',
|
||||||
certManager: new MemoryCertManager(),
|
certManager: new certmanagers.MemoryCertManager(),
|
||||||
environment: 'integration',
|
environment: 'integration',
|
||||||
retryOptions: {},
|
retryOptions: {},
|
||||||
challengeHandlers: [new DummyHandler()],
|
challengeHandlers: [new DummyHandler()],
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartacme',
|
name: '@push.rocks/smartacme',
|
||||||
version: '7.2.4',
|
version: '7.3.0',
|
||||||
description: 'A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.'
|
description: 'A TypeScript-based ACME client for LetsEncrypt certificate management with a focus on simplicity and power.'
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
export * from './smartacme.classes.smartacme.js';
|
export * from './smartacme.classes.smartacme.js';
|
||||||
export { SmartacmeCert as Cert } from './smartacme.classes.cert.js';
|
export { SmartacmeCert as Cert } from './smartacme.classes.cert.js';
|
||||||
export type { ICertManager } from './interfaces/certmanager.js';
|
export type { ICertManager } from './interfaces/certmanager.js';
|
||||||
export { MemoryCertManager, MongoCertManager } from './certmanagers/index.js';
|
|
||||||
|
// certmanagers
|
||||||
|
import * as certmanagers from './certmanagers/index.js';
|
||||||
|
export { certmanagers };
|
||||||
|
|
||||||
|
// handlers
|
||||||
|
import * as handlers from './handlers/index.js';
|
||||||
|
export { handlers };
|
||||||
|
@ -8,8 +8,8 @@ import { SmartacmeCert } from './smartacme.classes.cert.js';
|
|||||||
* the options for the class @see SmartAcme
|
* the options for the class @see SmartAcme
|
||||||
*/
|
*/
|
||||||
export interface ISmartAcmeOptions {
|
export interface ISmartAcmeOptions {
|
||||||
accountPrivateKey?: string;
|
|
||||||
accountEmail: string;
|
accountEmail: string;
|
||||||
|
accountPrivateKey?: string;
|
||||||
/**
|
/**
|
||||||
* Certificate storage manager (e.g., Mongo or in-memory).
|
* Certificate storage manager (e.g., Mongo or in-memory).
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user