add template

This commit is contained in:
AJ ONeal 2019-07-23 22:33:32 -06:00
parent fb5b430773
commit 948e6510ba
9 changed files with 228 additions and 2 deletions

17
.jshintrc Normal file
View File

@ -0,0 +1,17 @@
{ "node": true
, "browser": true
, "jquery": true
, "globals": { "Promise": true }
, "indent": 2
, "onevar": true
, "laxcomma": true
, "laxbreak": true
, "curly": true
, "nonbsp": true
, "eqeqeq": true
, "immed": true
, "undef": true
, "latedef": "nofunc"
}

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"bracketSpacing": true,
"printWidth": 80,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": true
}

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)

112
README.md
View File

@ -1,3 +1,111 @@
# acme-dns-01-dnsimple.js # [acme-dns-01-dnsimple.js](https://git.rootprojects.org/root/acme-dns-01-dnsimple.js) | a [Root](https://rootprojects.org/) project
DNSimple + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js DNSimple DNS + Let's Encrypt for Node.js - ACME dns-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.
# Features
- Compatible
- Lets Encrypt v2.1 / ACME draft 18 (2019)
- DNSimple API
- ACME.js, Greenlock.js, and others
- Quality
- node v6 compatible VanillaJS
- < 150 lines of code
- Zero Dependencies
# Install
```js
npm install --save acme-dns-01-dnsimple
```
DNSimple Token:
- Login to your account at: {{ Service URL }}
- {{ Instructions to generate token }}
# Usage
First you create an instance with your credentials:
```js
var dns01 = require('acme-dns-01-dnsimple').create({
baseUrl: '{{ api url }}', // default
token: 'xxxx'
});
```
Then you can use it with any compatible ACME library, such as Greenlock.js or ACME.js.
## Greenlock.js
```js
var Greenlock = require('greenlock-express');
var greenlock = Greenlock.create({
challenges: {
'dns-01': dns01
// ...
}
});
```
See [Greenlock Express](https://git.rootprojects.org/root/greenlock-express.js) and/or [Greenlock.js](https://git.rootprojects.org/root/greenlock.js) documentation for more details.
## ACME.js
```js
// TODO
```
See the [ACME.js](https://git.rootprojects.org/root/acme-v2.js) for more details.
## Build your own
There are only 5 methods:
- `init(config)`
- `zones(opts)`
- `set(opts)`
- `get(opts)`
- `remove(opts)`
```js
dns01
.set({
identifier: { value: 'foo.example.co.uk' },
wildcard: false,
dnsZone: 'example.co.uk',
dnsPrefix: '_acme-challenge.foo',
dnsAuthorization: 'xxx_secret_xxx'
})
.then(function() {
console.log('TXT record set');
})
.catch(function() {
console.log('Failed to set TXT record');
});
```
See acme-dns-01-test for more implementation details.
# Tests
```bash
# node ./test.js domain-zone username password
node ./test.js example.com johndoe xxxxxx
```
# Authors
- AJ ONeal
See AUTHORS for contact info.
# Legal
[acme-dns-01-dnsimple.js](https://git.coolaj86.com/coolaj86/acme-dns-01-dnsimple.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

3
example.env Normal file
View File

@ -0,0 +1,3 @@
ZONE=example.co.uk
USERNAME=johndoe
PASSWORD=xxxxxxxx

3
index.js Normal file
View File

@ -0,0 +1,3 @@
'use strict';
module.exports = require('./lib/index.js');

29
lib/index.js Normal file
View File

@ -0,0 +1,29 @@
'use strict';
var request;
var defaults = {};
module.exports.create = function(config) {
return {
init: function(opts) {
request = opts.request;
return null;
},
zones: function(data) {
//console.info('List Zones', data);
throw Error('listing zones not implemented');
},
set: function(data) {
// console.info('Add TXT', data);
throw Error('setting TXT not implemented');
},
remove: function(data) {
// console.info('Remove TXT', data);
throw Error('removing TXT not implemented');
},
get: function(data) {
// console.info('List TXT', data);
throw Error('listing TXTs not implemented');
}
};
};

32
package.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "acme-dns-01-dnsimple",
"version": "0.0.1",
"description": "DNSimple + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js",
"main": "index.js",
"files": [
"lib",
"test.js"
],
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "https://git.coolaj86.com/coolaj86/acme-dns-01-dnsimple.js.git"
},
"keywords": [
"dnsimple",
"dns",
"dns-01",
"letsencrypt",
"acme",
"greenlock"
],
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
"license": "MPL-2.0",
"devDependencies": {
"acme-challenge-test": "^3.3.2",
"dotenv": "^8.0.0"
},
"dependencies": {}
}

25
test.js Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env node
'use strict';
// See https://git.coolaj86.com/coolaj86/acme-challenge-test.js
var tester = require('acme-challenge-test');
require('dotenv').config();
// Usage: node ./test.js example.com username xxxxxxxxx
var zone = process.argv[2] || process.env.ZONE;
var challenger = require('./index.js').create({
username: process.argv[3] || process.env.USERNAME,
password: process.argv[4] || process.env.PASSWORD
});
// 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)
.then(function() {
console.info('PASS', zone);
})
.catch(function(e) {
console.error(e.message);
console.error(e.stack);
});