@certd/acme-client 0.1.6 → 0.2.0

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
@@ -1,199 +1,199 @@
1
- # acme-client [![CircleCI](https://circleci.com/gh/publishlab/node-acme-client.svg?style=svg)](https://circleci.com/gh/publishlab/node-acme-client)
2
-
3
- *A simple and unopinionated ACME client.*
4
-
5
- This module is written to handle communication with a Boulder/Let's Encrypt-style ACME API.
6
-
7
- * RFC 8555 - Automatic Certificate Management Environment (ACME): [https://tools.ietf.org/html/rfc8555](https://tools.ietf.org/html/rfc8555)
8
- * Boulder divergences from ACME: [https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md](https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md)
9
-
10
-
11
- ### Compatibility
12
-
13
- | acme-client | API | Style | Node.js |
14
- | ------------- | --------- | --------- | ------- |
15
- | v4.x | ACMEv2 | Promise | >= v10 |
16
- | v3.x | ACMEv2 | Promise | >= v8 |
17
- | v2.x | ACMEv2 | Promise | >= v4 |
18
- | v1.x | ACMEv1 | callback | >= v4 |
19
-
20
-
21
- ### Table of contents
22
-
23
- * [Installation](#installation)
24
- * [Usage](#usage)
25
- * [Cryptography](#cryptography)
26
- * [Auto mode](#auto-mode)
27
- * [Challenge priority](#challenge-priority)
28
- * [Internal challenge verification](#internal-challenge-verification)
29
- * [API](#api)
30
- * [HTTP client defaults](#http-client-defaults)
31
- * [Debugging](#debugging)
32
- * [License](#license)
33
-
34
-
35
- ## Installation
36
-
37
- ```bash
38
- $ npm install acme-client
39
- ```
40
-
41
-
42
- ## Usage
43
-
44
- ```js
45
- const acme = require('acme-client');
46
-
47
- const accountPrivateKey = '<PEM encoded private key>';
48
-
49
- const client = new acme.Client({
50
- directoryUrl: acme.directory.letsencrypt.staging,
51
- accountKey: accountPrivateKey
52
- });
53
- ```
54
-
55
-
56
- ### Directory URLs
57
-
58
- ```js
59
- acme.directory.letsencrypt.staging;
60
- acme.directory.letsencrypt.production;
61
- ```
62
-
63
-
64
- ## Cryptography
65
-
66
- For key pair generation and Certificate Signing Requests, `acme-client` uses [node-forge](https://www.npmjs.com/package/node-forge), a pure JavaScript implementation of the TLS protocol.
67
-
68
- These utility methods are exposed through `.forge`.
69
-
70
- __API documentation: [docs/forge.md](docs/forge.md)__
71
-
72
-
73
- #### Example
74
-
75
- ```js
76
- const privateKey = await acme.forge.createPrivateKey();
77
-
78
- const [certificateKey, certificateCsr] = await acme.forge.createCsr({
79
- commonName: '*.example.com',
80
- altNames: ['example.com']
81
- });
82
- ```
83
-
84
-
85
- ## Auto mode
86
-
87
- For convenience an `auto()` method is included in the client that takes a single config object. This method will handle the entire process of getting a certificate for one or multiple domains.
88
-
89
- A full example can be found at [examples/auto.js](examples/auto.js).
90
-
91
- __Documentation: [docs/client.md#AcmeClient+auto](docs/client.md#AcmeClient+auto)__
92
-
93
-
94
- #### Example
95
-
96
- ```js
97
- const autoOpts = {
98
- csr: '<PEM encoded CSR>',
99
- email: 'test@example.com',
100
- termsOfServiceAgreed: true,
101
- challengeCreateFn: async (authz, challenge, keyAuthorization) => {},
102
- challengeRemoveFn: async (authz, challenge, keyAuthorization) => {}
103
- };
104
-
105
- const certificate = await client.auto(autoOpts);
106
- ```
107
-
108
-
109
- ### Challenge priority
110
-
111
- When ordering a certificate using auto mode, `acme-client` uses a priority list when selecting challenges to respond to. Its default value is `['http-01', 'dns-01']` which translates to "use `http-01` if any challenges exist, otherwise fall back to `dns-01`".
112
-
113
- While most challenges can be validated using the method of your choosing, please note that __wildcard certificates can only be validated through `dns-01`__. More information regarding Let's Encrypt challenge types [can be found here](https://letsencrypt.org/docs/challenge-types/).
114
-
115
- To modify challenge priority, provide a list of challenge types in `challengePriority`:
116
-
117
- ```js
118
- await client.auto({
119
- ...,
120
- challengePriority: ['http-01', 'dns-01']
121
- });
122
- ```
123
-
124
-
125
- ### Internal challenge verification
126
-
127
- When using auto mode, `acme-client` will first validate that challenges are satisfied internally before completing the challenge at the ACME provider. In some cases (firewalls, etc) this internal challenge verification might not be possible to complete.
128
-
129
- If internal challenge validation needs to travel through an HTTP proxy, see [HTTP client defaults](#http-client-defaults).
130
-
131
- To completely disable `acme-client`s internal challenge verification, enable `skipChallengeVerification`:
132
-
133
- ```js
134
- await client.auto({
135
- ...,
136
- skipChallengeVerification: true
137
- });
138
- ```
139
-
140
-
141
- ## API
142
-
143
- For more fine-grained control you can interact with the ACME API using the methods documented below.
144
-
145
- A full example can be found at [examples/api.js](examples/api.js).
146
-
147
- __API documentation: [docs/client.md](docs/client.md)__
148
-
149
-
150
- #### Example
151
-
152
- ```js
153
- const account = await client.createAccount({
154
- termsOfServiceAgreed: true,
155
- contact: ['mailto:test@example.com']
156
- });
157
-
158
- const order = await client.createOrder({
159
- identifiers: [
160
- { type: 'dns', value: 'example.com' },
161
- { type: 'dns', value: '*.example.com' }
162
- ]
163
- });
164
- ```
165
-
166
-
167
- ## HTTP client defaults
168
-
169
- This module uses [axios](https://github.com/axios/axios) when communicating with the ACME HTTP API, and exposes the client instance through `.axios`.
170
-
171
- For example, should you need to change the default axios configuration to route requests through an HTTP proxy, this can be achieved as follows:
172
-
173
- ```js
174
- const acme = require('acme-client');
175
-
176
- acme.axios.defaults.proxy = {
177
- host: '127.0.0.1',
178
- port: 9000
179
- };
180
- ```
181
-
182
- A complete list of axios options and documentation can be found at:
183
-
184
- * [https://github.com/axios/axios#request-config](https://github.com/axios/axios#request-config)
185
- * [https://github.com/axios/axios#custom-instance-defaults](https://github.com/axios/axios#custom-instance-defaults)
186
-
187
-
188
- ## Debugging
189
-
190
- `acme-client` uses [debug](https://www.npmjs.com/package/debug) for debugging which can be enabled by running
191
-
192
- ```bash
193
- DEBUG=acme-client node index.js
194
- ```
195
-
196
-
197
- ## License
198
-
199
- [MIT](LICENSE)
1
+ # acme-client [![CircleCI](https://circleci.com/gh/publishlab/node-acme-client.svg?style=svg)](https://circleci.com/gh/publishlab/node-acme-client)
2
+
3
+ *A simple and unopinionated ACME client.*
4
+
5
+ This module is written to handle communication with a Boulder/Let's Encrypt-style ACME API.
6
+
7
+ * RFC 8555 - Automatic Certificate Management Environment (ACME): [https://tools.ietf.org/html/rfc8555](https://tools.ietf.org/html/rfc8555)
8
+ * Boulder divergences from ACME: [https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md](https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md)
9
+
10
+
11
+ ### Compatibility
12
+
13
+ | acme-client | API | Style | Node.js |
14
+ | ------------- | --------- | --------- | ------- |
15
+ | v4.x | ACMEv2 | Promise | >= v10 |
16
+ | v3.x | ACMEv2 | Promise | >= v8 |
17
+ | v2.x | ACMEv2 | Promise | >= v4 |
18
+ | v1.x | ACMEv1 | callback | >= v4 |
19
+
20
+
21
+ ### Table of contents
22
+
23
+ * [Installation](#installation)
24
+ * [Usage](#usage)
25
+ * [Cryptography](#cryptography)
26
+ * [Auto mode](#auto-mode)
27
+ * [Challenge priority](#challenge-priority)
28
+ * [Internal challenge verification](#internal-challenge-verification)
29
+ * [API](#api)
30
+ * [HTTP client defaults](#http-client-defaults)
31
+ * [Debugging](#debugging)
32
+ * [License](#license)
33
+
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ $ npm install acme-client
39
+ ```
40
+
41
+
42
+ ## Usage
43
+
44
+ ```js
45
+ const acme = require('acme-client');
46
+
47
+ const accountPrivateKey = '<PEM encoded private key>';
48
+
49
+ const client = new acme.Client({
50
+ directoryUrl: acme.directory.letsencrypt.staging,
51
+ accountKey: accountPrivateKey
52
+ });
53
+ ```
54
+
55
+
56
+ ### Directory URLs
57
+
58
+ ```js
59
+ acme.directory.letsencrypt.staging;
60
+ acme.directory.letsencrypt.production;
61
+ ```
62
+
63
+
64
+ ## Cryptography
65
+
66
+ For key pair generation and Certificate Signing Requests, `acme-client` uses [node-forge](https://www.npmjs.com/package/node-forge), a pure JavaScript implementation of the TLS protocol.
67
+
68
+ These utility methods are exposed through `.forge`.
69
+
70
+ __API documentation: [docs/forge.md](docs/forge.md)__
71
+
72
+
73
+ #### Example
74
+
75
+ ```js
76
+ const privateKey = await acme.forge.createPrivateKey();
77
+
78
+ const [certificateKey, certificateCsr] = await acme.forge.createCsr({
79
+ commonName: '*.example.com',
80
+ altNames: ['example.com']
81
+ });
82
+ ```
83
+
84
+
85
+ ## Auto mode
86
+
87
+ For convenience an `auto()` method is included in the client that takes a single config object. This method will handle the entire process of getting a certificate for one or multiple domains.
88
+
89
+ A full example can be found at [examples/auto.js](examples/auto.js).
90
+
91
+ __Documentation: [docs/client.md#AcmeClient+auto](docs/client.md#AcmeClient+auto)__
92
+
93
+
94
+ #### Example
95
+
96
+ ```js
97
+ const autoOpts = {
98
+ csr: '<PEM encoded CSR>',
99
+ email: 'test@example.com',
100
+ termsOfServiceAgreed: true,
101
+ challengeCreateFn: async (authz, challenge, keyAuthorization) => {},
102
+ challengeRemoveFn: async (authz, challenge, keyAuthorization) => {}
103
+ };
104
+
105
+ const certificate = await client.auto(autoOpts);
106
+ ```
107
+
108
+
109
+ ### Challenge priority
110
+
111
+ When ordering a certificate using auto mode, `acme-client` uses a priority list when selecting challenges to respond to. Its default value is `['http-01', 'dns-01']` which translates to "use `http-01` if any challenges exist, otherwise fall back to `dns-01`".
112
+
113
+ While most challenges can be validated using the method of your choosing, please note that __wildcard certificates can only be validated through `dns-01`__. More information regarding Let's Encrypt challenge types [can be found here](https://letsencrypt.org/docs/challenge-types/).
114
+
115
+ To modify challenge priority, provide a list of challenge types in `challengePriority`:
116
+
117
+ ```js
118
+ await client.auto({
119
+ ...,
120
+ challengePriority: ['http-01', 'dns-01']
121
+ });
122
+ ```
123
+
124
+
125
+ ### Internal challenge verification
126
+
127
+ When using auto mode, `acme-client` will first validate that challenges are satisfied internally before completing the challenge at the ACME provider. In some cases (firewalls, etc) this internal challenge verification might not be possible to complete.
128
+
129
+ If internal challenge validation needs to travel through an HTTP proxy, see [HTTP client defaults](#http-client-defaults).
130
+
131
+ To completely disable `acme-client`s internal challenge verification, enable `skipChallengeVerification`:
132
+
133
+ ```js
134
+ await client.auto({
135
+ ...,
136
+ skipChallengeVerification: true
137
+ });
138
+ ```
139
+
140
+
141
+ ## API
142
+
143
+ For more fine-grained control you can interact with the ACME API using the methods documented below.
144
+
145
+ A full example can be found at [examples/api.js](examples/api.js).
146
+
147
+ __API documentation: [docs/client.md](docs/client.md)__
148
+
149
+
150
+ #### Example
151
+
152
+ ```js
153
+ const account = await client.createAccount({
154
+ termsOfServiceAgreed: true,
155
+ contact: ['mailto:test@example.com']
156
+ });
157
+
158
+ const order = await client.createOrder({
159
+ identifiers: [
160
+ { type: 'dns', value: 'example.com' },
161
+ { type: 'dns', value: '*.example.com' }
162
+ ]
163
+ });
164
+ ```
165
+
166
+
167
+ ## HTTP client defaults
168
+
169
+ This module uses [axios](https://github.com/axios/axios) when communicating with the ACME HTTP API, and exposes the client instance through `.axios`.
170
+
171
+ For example, should you need to change the default axios configuration to route requests through an HTTP proxy, this can be achieved as follows:
172
+
173
+ ```js
174
+ const acme = require('acme-client');
175
+
176
+ acme.axios.defaults.proxy = {
177
+ host: '127.0.0.1',
178
+ port: 9000
179
+ };
180
+ ```
181
+
182
+ A complete list of axios options and documentation can be found at:
183
+
184
+ * [https://github.com/axios/axios#request-config](https://github.com/axios/axios#request-config)
185
+ * [https://github.com/axios/axios#custom-instance-defaults](https://github.com/axios/axios#custom-instance-defaults)
186
+
187
+
188
+ ## Debugging
189
+
190
+ `acme-client` uses [debug](https://www.npmjs.com/package/debug) for debugging which can be enabled by running
191
+
192
+ ```bash
193
+ DEBUG=acme-client node index.js
194
+ ```
195
+
196
+
197
+ ## License
198
+
199
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@certd/acme-client",
3
3
  "description": "Simple and unopinionated ACME client,base version 4.1.2",
4
- "author": "nmorsman",
5
- "version": "0.1.6",
4
+ "author": "greper",
5
+ "version": "0.2.0",
6
6
  "main": "src/index.js",
7
7
  "types": "types",
8
8
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "build-docs": "jsdoc2md src/client.js > docs/client.md && jsdoc2md src/crypto/forge.js > docs/forge.md",
42
42
  "lint": "eslint .",
43
43
  "lint-types": "dtslint types",
44
- "prepublishOnly": "npm run build-docs",
44
+ "1prepublishOnly": "npm run build-docs",
45
45
  "test": "mocha -b -t 60000 \"test/setup.js\" \"test/**/*.spec.js\"",
46
46
  "test-local": "/bin/bash scripts/run-tests.sh",
47
47
  "build": "webpack ./src/index.js ./dist/bundle.js"
@@ -60,5 +60,6 @@
60
60
  ],
61
61
  "bugs": {
62
62
  "url": "https://github.com/publishlab/node-acme-client/issues"
63
- }
63
+ },
64
+ "gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
64
65
  }