@metric-im/administrate 1.1.1 → 1.1.3
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/certify.mjs +23 -4
- package/package.json +1 -1
package/certify.mjs
CHANGED
|
@@ -118,7 +118,7 @@ export class Certify {
|
|
|
118
118
|
return;
|
|
119
119
|
} else {
|
|
120
120
|
if (!this.contactEmail) throw new Error(`cannot request certificate without CONTACT_EMAIL set`);
|
|
121
|
-
this.pending[sitename] =
|
|
121
|
+
this.pending[sitename] = moment();
|
|
122
122
|
|
|
123
123
|
try {
|
|
124
124
|
// Add timeout wrapper for the entire certificate renewal process
|
|
@@ -137,10 +137,29 @@ export class Certify {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
async doRenewCert(sitename) {
|
|
140
|
-
//
|
|
141
|
-
const
|
|
140
|
+
// Check if domain has an epistery address
|
|
141
|
+
const domainConfig = this.config.read(sitename);
|
|
142
|
+
const episteryAddress = domainConfig?.wallet?.address;
|
|
143
|
+
|
|
144
|
+
// Prepare CSR options
|
|
145
|
+
const csrOptions = {
|
|
142
146
|
altNames: [sitename],
|
|
143
|
-
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// If epistery address exists, bind it to the certificate per X.509 standards
|
|
150
|
+
if (episteryAddress) {
|
|
151
|
+
// RFC 5280: Use organization (O) field to identify Rootz Corp as binding provider
|
|
152
|
+
csrOptions.organization = 'Rootz Corp';
|
|
153
|
+
// RFC 5280: Use organizationUnit (OU) to store epistery identity address
|
|
154
|
+
// This binds the domain to the epistery address in the certificate
|
|
155
|
+
// Users can verify at /.well-known/epistery/status (RFC 8615 well-known URI)
|
|
156
|
+
csrOptions.organizationUnit = `Epistery: ${episteryAddress}`;
|
|
157
|
+
console.log(`Binding epistery identity ${episteryAddress} to certificate for ${sitename}`);
|
|
158
|
+
console.log(`Epistery binding verifiable at https://${sitename}/.well-known/epistery/status`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// create CSR
|
|
162
|
+
const [key, csr] = await Acme.crypto.createCsr(csrOptions);
|
|
144
163
|
|
|
145
164
|
// order certificate with timeout
|
|
146
165
|
const cert = await this.acme.auto({
|