@metric-im/administrate 1.1.0 → 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.
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Read(//home/msprague/workspace/rootz/epistery/docs/**)",
5
- "Read(//home/msprague/workspace/rootz/epistery/src/**)",
6
- "Read(//home/msprague/workspace/rootz/epistery/**)",
7
- "Read(//home/msprague/workspace/rootz/rhonda/node_modules/epistery/**)",
8
- "Read(//home/msprague/workspace/rootz/rhonda/**)"
4
+ "Read(//home/msprague/workspace/sitewell/**)",
5
+ "Read(//home/msprague/workspace/rootz/data-wallet-demos/**)"
9
6
  ],
10
7
  "deny": [],
11
8
  "ask": []
12
9
  }
13
- }
10
+ }
package/certify.mjs CHANGED
@@ -17,11 +17,12 @@ export class Certify {
17
17
  }
18
18
  static async attach(app,options) {
19
19
  const instance = new Certify(app,options);
20
- instance.config = new Config(); // Uses default 'epistery' root
20
+ instance.config = new Config();
21
21
 
22
22
  // Load root config to get contact email
23
23
  instance.config.setPath('/');
24
24
  instance.config.load();
25
+
25
26
  instance.contactEmail = instance.options.contactEmail || instance.config.data.ssl?.email || instance.config.data.profile?.email;
26
27
 
27
28
  instance.acme = new Acme.Client({
@@ -117,7 +118,7 @@ export class Certify {
117
118
  return;
118
119
  } else {
119
120
  if (!this.contactEmail) throw new Error(`cannot request certificate without CONTACT_EMAIL set`);
120
- this.pending[sitename] = true;
121
+ this.pending[sitename] = moment();
121
122
 
122
123
  try {
123
124
  // Add timeout wrapper for the entire certificate renewal process
@@ -136,10 +137,29 @@ export class Certify {
136
137
  }
137
138
 
138
139
  async doRenewCert(sitename) {
139
- // create CSR
140
- const [key, csr] = await Acme.crypto.createCsr({
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 = {
141
146
  altNames: [sitename],
142
- });
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);
143
163
 
144
164
  // order certificate with timeout
145
165
  const cert = await this.acme.auto({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metric-im/administrate",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
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.0"
28
+ "epistery": "^1.0.3"
29
29
  }
30
30
  }