diff --git a/README.md b/README.md index 6c45341..db0eb8b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# [acme-dns-01-{{servicename}}.js](https://git.rootprojects.org/root/acme-dns-01-{{servicename}}.js) | a [Root](https://rootprojects.org/) project +# [acme-http-01-{{servicename}}.js](https://git.rootprojects.org/root/acme-http-01-{{servicename}}.js) | a [Root](https://rootprojects.org/) project -{{ Service Title }} DNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js +{{ Service Title }} Storage + Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js -Handles ACME dns-01 challenges. Compatible with ACME.js and Greenlock.js. Passes acme-dns-01-test. +Handles ACME http-01 challenges. Compatible with ACME.js and Greenlock.js. Passes acme-http-01-test. # Features @@ -18,7 +18,7 @@ Handles ACME dns-01 challenges. Compatible with ACME.js and Greenlock.js. Passes # Install ```js -npm install --save acme-dns-01-{{servicename}} +npm install --save acme-http-01-{{servicename}} ``` {{ Service Title }} Token: @@ -31,7 +31,7 @@ npm install --save acme-dns-01-{{servicename}} First you create an instance with your credentials: ```js -var dns01 = require('acme-dns-01-{{servicename}}').create({ +var http01 = require('acme-http-01-{{servicename}}').create({ baseUrl: '{{ api url }}', // default token: 'xxxx' }); @@ -45,9 +45,9 @@ Then you can use it with any compatible ACME library, such as Greenlock.js or AC var Greenlock = require('greenlock-express'); var greenlock = Greenlock.create({ challenges: { - 'dns-01': dns01 - // ... + 'http-01': http01 } + // ... }); ``` @@ -63,32 +63,30 @@ See the [ACME.js](https://git.rootprojects.org/root/acme-v2.js) for more details ## Build your own -There are only 5 methods: +There are only 4 methods: - `init(config)` -- `zones(opts)` - `set(opts)` - `get(opts)` - `remove(opts)` ```js -dns01 +http01 .set({ - identifier: { value: 'foo.example.co.uk' }, - wildcard: false, - dnsZone: 'example.co.uk', - dnsPrefix: '_acme-challenge.foo', - dnsAuthorization: 'xxx_secret_xxx' + altname: 'foo.example.co.uk', + token: 'xxxx' + keyAuthorization: 'xxxx.yyyy' }) .then(function() { - console.log('TXT record set'); + console.log('Saved ACME key authorization file'); }) - .catch(function() { - console.log('Failed to set TXT record'); + .catch(function(err) { + console.error('Failed to save ACME key authorization file'); + console.error(err); }); ``` -See acme-dns-01-test for more implementation details. +See acme-http-01-test for more implementation details. # Tests @@ -105,7 +103,7 @@ See AUTHORS for contact info. # Legal -[acme-dns-01-{{servicename}}.js](https://git.coolaj86.com/coolaj86/acme-dns-01-{{servicename}}.js) | MPL-2.0 | [Terms of Use](https://therootcompany.com/legal/#terms) | [Privacy Policy](https://therootcompany.com/legal/#privacy) +[acme-http-01-{{servicename}}.js](https://git.coolaj86.com/coolaj86/acme-http-01-{{servicename}}.js) | MPL-2.0 | [Terms of Use](https://therootcompany.com/legal/#terms) | [Privacy Policy](https://therootcompany.com/legal/#privacy) Copyright 2019 AJ ONeal Copyright 2019 The Root Group LLC diff --git a/lib/index.js b/lib/index.js index 3eb30e4..ee756c9 100644 --- a/lib/index.js +++ b/lib/index.js @@ -9,27 +9,23 @@ module.exports.create = function(config) { request = opts.request; return null; }, - zones: function(data) { - //console.info('List Zones', data); - throw Error('listing zones not implemented'); - }, + set: function(data) { var ch = data.challenge; - if (!ch.dnsZone) { - // zones() is not implemented for http-01 challenges, - // but it is almost always implemented for dns-01 challenges - throw new Error('No matching zone for ' + ch.dnsHost); - } - // console.info('Add TXT', data); - throw Error('setting TXT not implemented'); + // console.info('Add Key Auth URL', data); + throw Error('setting key authorization not implemented'); }, + remove: function(data) { - // console.info('Remove TXT', data); - throw Error('removing TXT not implemented'); + var ch = data.challenge; + // console.info('Remove Key Auth URL', data); + throw Error('removing key authorization not implemented'); }, + get: function(data) { - // console.info('List TXT', data); - throw Error('listing TXTs not implemented'); + var ch = data.challenge; + // console.info('List Key Auth URL', data); + throw Error('retrieving key authorization not implemented'); } }; }; diff --git a/package.json b/package.json index 7e92eb1..85054f4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "acme-dns-01-{{servicename}}", + "name": "acme-http-01-{{servicename}}", "version": "0.0.1", - "description": "{{ Service Title }} + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js", + "description": "{{ Service Title }} + Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js", "main": "index.js", "files": [ "lib", @@ -12,12 +12,12 @@ }, "repository": { "type": "git", - "url": "https://git.coolaj86.com/coolaj86/acme-dns-01-{{servicename}}.js.git" + "url": "https://git.coolaj86.com/coolaj86/acme-http-01-{{servicename}}.js.git" }, "keywords": [ "{{servicename}}", - "dns", - "dns-01", + "storage", + "http-01", "letsencrypt", "acme", "greenlock" diff --git a/test.js b/test.js index d8b9412..e40e367 100755 --- a/test.js +++ b/test.js @@ -5,18 +5,20 @@ var tester = require('acme-challenge-test'); require('dotenv').config(); -// Usage: node ./test.js example.com xxxxxxxxx -var zone = process.argv[2] || process.env.ZONE; +// Usage: node ./test.js example.com username xxxxxxxxx +var record = process.argv[2] || process.env.RECORD; var challenger = require('./index.js').create({ - token: process.argv[3] || process.env.TOKEN + webroot: + '/tmp/acme-tests/{domain}/.well-known/acme-challenges/' || + process.env.WEBROOT }); // The dry-run tests can pass on, literally, 'example.com' // but the integration tests require that you have control over the domain tester - .testZone('dns-01', zone, challenger) + .testRecord('http-01', record, challenger) .then(function() { - console.info('PASS', zone); + console.info('PASS', record); }) .catch(function(e) { console.error(e.message);