# [acme-dns-01-digitalocean](https://git.rootprojects.org/root/acme-dns-01-digitalocean.js) | a [Root](https://rootprojects.org) project

Digital Ocean DNS + Let's Encrypt for Node.js

This handles ACME dns-01 challenges, compatible with ACME.js and Greenlock.js.
Passes [acme-dns-01-test](https://git.rootprojects.org/root/acme-dns-01-test.js).

## Features

- Compatible
  - [x] Let's Encrypt v2.1 / ACME draft 18 (2019)
  - [x] Digital Ocean v2 API
  - [x] ACME.js, Greenlock.js, and others
- Quality
  - [x] node v6 compatible VanillaJS
  - [x] &lt; 150 lines of code
  - [x] **Zero Dependencies**

# Install

```bash
npm install --save acme-dns-01-digitalocean@3.x
```

Generate Digital Ocean API Token:

- <https://cloud.digitalocean.com/account/api/tokens>

# Usage

First you create an instance with your credentials:

```js
var dns01 = require('acme-dns-01-digitalocean').create({
	baseUrl: 'https://api.digitalocean.com/v2/domains', // 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](https://git.rootprojects.org/root/acme-dns-01-test.js)
for more implementation details.

# Tests

```bash
# node ./test.js domain-zone api-token
node ./test.js example.com xxxxxx
```

# Authors

- Aneem Patrabansha
- AJ ONeal

See AUTHORS for contact info.

<!-- {{ if .Legal }} -->

# Legal

[acme-dns-01-digitalocean.js](https://git.coolaj86.com/coolaj86/acme-dns-01-digitalocean.js) |
MPL-2.0 |
[Terms of Use](https://therootcompany.com/legal/#terms) |
[Privacy Policy](https://therootcompany.com/legal/#privacy)

Copyright 2019 The Root Group LLC

<!-- {{ end }} -->
