@small-tech/auto-encrypt 4.1.0 → 4.1.1

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/README.md CHANGED
@@ -14,8 +14,6 @@ When not provisioning certificates, Auto Encrypt also forwards HTTP calls to HTT
14
14
 
15
15
  All tests pass on Node.js LTS (version 22).
16
16
 
17
- [Tests fail on Node.js 19 (socket hang up error).](https://codeberg.org/small-tech/auto-encrypt/issues/3)
18
-
19
17
  ## Installation
20
18
 
21
19
  ```sh
@@ -6,6 +6,9 @@
6
6
  * @license AGPLv3 or later.
7
7
  */
8
8
 
9
+ import fs from 'fs'
10
+ import path from 'path'
11
+ import { fileURLToPath } from 'url'
9
12
  import jose from 'jose'
10
13
  import prepareRequest from 'bent'
11
14
  import types from '../typedefs/lib/AcmeRequest.js'
@@ -23,6 +26,7 @@ const throws = new Throws({
23
26
  [Symbol.for('AcmeRequest.requestError')]: error => `(${error.status} ${error.type} ${error.detail})`
24
27
  })
25
28
 
29
+ const __dirname = fileURLToPath(new URL('.', import.meta.url))
26
30
  /**
27
31
  * Abstract base request class for carrying out signed ACME requests over HTTPS.
28
32
  *
@@ -34,6 +38,8 @@ export default class AcmeRequest {
34
38
  static accountIdentity = null
35
39
  static nonce = null
36
40
  static __account = null
41
+ /** @type {string} */
42
+ static autoEncryptVersion = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'))).version
37
43
 
38
44
  static initialise (directory = throws.ifMissing(), accountIdentity = throws.ifMissing()) {
39
45
  this.directory = directory
@@ -228,7 +234,7 @@ export default class AcmeRequest {
228
234
 
229
235
  const httpsHeaders = {
230
236
  'Content-Type': 'application/jose+json',
231
- 'User-Agent': 'small-tech.org-acme/1.0.0 node/12.16.0',
237
+ 'User-Agent': `small-tech.org-auto-encrypt/${AcmeRequest.autoEncryptVersion}`,
232
238
  'Accept-Language': 'en-US'
233
239
  }
234
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@small-tech/auto-encrypt",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Automatically provisions and renews Let’s Encrypt TLS certificates on Node.js https servers (including Kitten, Polka, Express.js, etc.)",
5
5
  "engines": {
6
6
  "node": ">=18.2.0"