@metric-im/administrate 1.1.3 → 1.1.6

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.
Files changed (2) hide show
  1. package/certify.mjs +22 -15
  2. package/package.json +2 -2
package/certify.mjs CHANGED
@@ -40,6 +40,7 @@ export class Certify {
40
40
  get SNI() {
41
41
  return {SNICallback: async (hostname, cb) => {
42
42
  try {
43
+ if (this.pending[hostname]) return(cb('pending'));
43
44
  console.log(`SNL get keys for ${hostname}`)
44
45
  const siteKeys = await this.getSiteKeys(hostname);
45
46
  cb(null, tls.createSecureContext(siteKeys));
@@ -54,11 +55,15 @@ export class Certify {
54
55
 
55
56
  router.get(/^\/\.well-known\/acme-challenge\/([^\/]+)$/,(req,res)=>{
56
57
  const token = req.params[0];
58
+ console.log(`ACME challenge request for token: ${token}`);
59
+ console.log(`Available challenges:`, Object.keys(this.challenges));
57
60
  if (token in this.challenges) {
61
+ console.log(`✓ Challenge found, responding with authorization`);
58
62
  res.writeHead(200);
59
63
  res.end(this.challenges[token]);
60
64
  return;
61
65
  }
66
+ console.log(`✗ Challenge not found, returning 404`);
62
67
  // Don't redirect ACME challenges - return 404 instead (says Claude, used to be 302)
63
68
  res.writeHead(404);
64
69
  res.end('Challenge not found');
@@ -137,26 +142,25 @@ export class Certify {
137
142
  }
138
143
 
139
144
  async doRenewCert(sitename) {
140
- // Check if domain has an epistery address
141
- const domainConfig = this.config.read(sitename);
142
- const episteryAddress = domainConfig?.wallet?.address;
143
-
144
145
  // Prepare CSR options
145
146
  const csrOptions = {
146
147
  altNames: [sitename],
147
148
  };
148
149
 
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
- }
150
+ // // letsencrypt will not accept an OU it doesn't certify
151
+ // // Check if domain has an epistery address
152
+ // const domainConfig = this.config.read(sitename);
153
+ // const episteryAddress = domainConfig?.wallet?.address;
154
+ // if (episteryAddress) {
155
+ // // RFC 5280: Use organization (O) field to identify Rootz Corp as binding provider
156
+ // csrOptions.organization = 'Rootz Corp';
157
+ // // RFC 5280: Use organizationUnit (OU) to store epistery identity address
158
+ // // This binds the domain to the epistery address in the certificate
159
+ // // Users can verify at /.well-known/epistery/status (RFC 8615 well-known URI)
160
+ // csrOptions.organizationUnit = `Epistery: ${episteryAddress}`;
161
+ // console.log(`Binding epistery identity ${episteryAddress} to certificate for ${sitename}`);
162
+ // console.log(`Epistery binding verifiable at https://${sitename}/.well-known/epistery/status`);
163
+ // }
160
164
 
161
165
  // create CSR
162
166
  const [key, csr] = await Acme.crypto.createCsr(csrOptions);
@@ -168,9 +172,12 @@ export class Certify {
168
172
  termsOfServiceAgreed: true,
169
173
  challengePriority: ['http-01'],
170
174
  challengeCreateFn: (authz, challenge, keyAuthorization) => {
175
+ console.log(`✓ Challenge created - token: ${challenge.token}`);
176
+ console.log(` Challenge URL: http://${sitename}/.well-known/acme-challenge/${challenge.token}`);
171
177
  this.challenges[challenge.token] = keyAuthorization;
172
178
  },
173
179
  challengeRemoveFn: (authz, challenge) => {
180
+ console.log(`✓ Challenge removed - token: ${challenge.token}`);
174
181
  delete this.challenges[challenge.token];
175
182
  },
176
183
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metric-im/administrate",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "Tools for site administration",
5
5
  "homepage": "https://github.com/metric-im/administrate#readme",
6
6
  "bugs": {
@@ -25,6 +25,6 @@
25
25
  "moment": "^2.30.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "epistery": "^1.0.3"
28
+ "epistery": "^1.1.0"
29
29
  }
30
30
  }