v3.3.0: update docs and test dep

This commit is contained in:
AJ ONeal 2019-06-15 13:25:11 -06:00
parent 617720d380
commit cba3c635b7
2 changed files with 50 additions and 16 deletions

View File

@ -4,12 +4,13 @@ An ACME dns-01 test harness for Let's Encrypt integrations.
This was specificially designed for [ACME.js](https://git.coolaj86.com/coolaj86/acme-v2.js) and [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock-express.js), but will be generically useful to any ACME module.
Passing the tests is very easy. There are just four functions to implement:
Passing the tests is very easy. There are just five functions to implement:
- `zones()` - list domain zones (i.e. example.co.uk, example.com)
- `set()` - set a TXT record in a zone (i.e. `_acme-challenge.foo` in `example.com`)
- `get()` - confirm that the record was set
- `remove()` - clean up after the ACME challenge passes
- `init(deps)` - (optional) this gives you the `request` object you should use for HTTP APIs
- `zones(opts)` - list domain zones (i.e. example.co.uk, example.com)
- `set(opts)` - set a TXT record in a zone (i.e. `_acme-challenge.foo` in `example.co.jp`)
- `get(opts)` - confirm that the record was set
- `remove(opts)` - clean up after the ACME challenge completes
The tests account for single-domain certificates (`example.com`) as well as multiple domain certs (SAN / AltName),
wildcards (`*.example.com`), and valid private / localhost certificates. No worries on your end, just pass the tests. 👌
@ -55,15 +56,25 @@ tester.testRecord('dns-01', record, challenger).then(function() {
## Reference Implementations
These are plugins that use the v2.7+ (v3) API, and pass this test harness,
which you should use as a model for any plugins that you create.
- Compatibility
- [x] Let's Encrypt v2.1 / ACME draft 18
- [x] Node v6+
- [x] Chrome, Firefox, Safari, Edge, etc
- Quality
- [x] Written in VanillaJS
- [x] No compliers or build scripts
- [x] Simple, minimal code, in a single file
- [x] **Zero dependencies**
These libraries are useful as a model for any plugins that you create.
- dns-01
- [`acme-dns-01-cli`](https://git.rootprojects.org/root/acme-dns-01-cli.js)
- [`acme-dns-01-digitalocean`](https://git.rootprojects.org/root/acme-dns-01-digitalocean.js)
- [`cli`](https://git.rootprojects.org/root/acme-dns-01-cli.js)
- [`digitalocean`](https://git.rootprojects.org/root/acme-dns-01-digitalocean.js)
- [`vultr`](https://git.rootprojects.org/root/acme-dns-01-vultr.js)
- http-01
- [`acme-http-01-cli`](https://git.rootprojects.org/root/acme-http-01-cli.js)
- [`acme-http-01-fs`](https://git.rootprojects.org/root/acme-http-01-fs.js)
- [`cli`](https://git.rootprojects.org/root/acme-http-01-cli.js)
- [`fs`](https://git.rootprojects.org/root/acme-http-01-fs.js)
You can find other implementations by searching npm for [acme-http-01-](https://www.npmjs.com/search?q=acme-http-01-)
and [acme-dns-01-](https://www.npmjs.com/search?q=acme-dns-01-).
@ -71,6 +82,10 @@ and [acme-dns-01-](https://www.npmjs.com/search?q=acme-dns-01-).
If you are building a plugin, please let us know.
We may like to co-author and help maintain and promote your module.
<small>Note: In some cases (such as non-HTTP, or very complex APIs) you will not be able to maintain
browser compatibility. Other than than, if you keep your code simple, it will also work in browser
implementations of ACME.js.</small>
## Example
See `example.js` (it works).
@ -85,9 +100,16 @@ var tester = require('acme-dns-01-test');
// The dry-run tests can pass on, literally, 'example.com'
// but the integration tests require that you have control over the domain
var zone = 'example.com';
var request;
tester
.testZone('dns-01', zone, {
// Gives you the promisified `request` object for HTTP APIs
init: function(deps) {
request = deps.request;
return null;
},
// Should return an array of zone domain name strings
// (APIs that don't implement zones, such as DuckDNS, should return an empty array)
zones: function(opts) {
@ -143,8 +165,18 @@ See [acme-http-01-test.js](https://git.rootprojects.org/root/acme-dns-01-test.js
Here's a quick pseudo stub-out of what a test-passing plugin object might look like:
```js
var request;
tester
.testZone('dns-01', 'example.com', {
init: function(deps) {
// { request: { get, post, put, delete }
// }
request = deps.request;
return null;
},
zones: function(opts) {
// { dnsHosts: [
// '_acme-challenge.foo.example.com',
@ -217,9 +249,6 @@ Where `YourApi` might look something like this:
```js
var YourApi = function createApi(config) {
var request = require('@root/request');
request = require('util').promisify(request);
return function(method, url, body) {
return request({
method: method,
@ -235,6 +264,11 @@ var YourApi = function createApi(config) {
};
```
Note: `request` is actually `@root/request`, but the API is the same as the standard `request`.
Avoid using 3rd party API libraries where you can - they tend to bloat your dependencies and
add security risk. Instead, just use the API documentation and cURL examples.
### Two notes:
Note 1:

View File

@ -1,6 +1,6 @@
{
"name": "acme-dns-01-test",
"version": "3.2.1",
"version": "3.3.0",
"description": "ACME dns-01 tests for Let's Encrypt integration. Any `acme-dns-01-` plugin should be able to pass these tests.",
"main": "index.js",
"homepage": "https://git.rootprojects.org/root/acme-dns-01-test.js",
@ -9,7 +9,7 @@
"lib"
],
"dependencies": {
"acme-challenge-test": "^3.2.0"
"acme-challenge-test": "^3.3.1"
},
"devDependencies": {
"acme-dns-01-cli": "^3.1.0"