2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# [acme-dns-01-gandi.js](https://git.rootprojects.org/root/acme-dns-01-gandi.js) | a [Root](https://rootprojects.org/) project
  
						 
					
						
							
								
									
										
										
										
											2019-07-10 05:44:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Gandi LiveDNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This handles ACME dns-01 challenges, compatible with ACME.js and Greenlock.js. Passes acme-dns-01-test.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Features
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    Compatible 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    -    Let’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    -    Gandi.net LiveDNS API
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    -    ACME.js, Greenlock.js, and others
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    Quality 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    -    node v6 compatible VanillaJS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    -    <  150  lines  of  code 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    -    Zero Dependencies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Install
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								npm install --save acme-dns-01-gandi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Generate Gandi LiveDNS API Token:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								-    Login to your account at: https://account.gandi.net/ 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    Under the Security section, click the link next to 'Production API key' to generate a token. 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Usage
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								First you create an instance with your credentials:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								var dns01 = require('acme-dns-01-gandi').create({
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									baseUrl: 'https://dns.api.gandi.net/api/v5/', // default
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									token: 'xxxx'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								});
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Then you can use it with any compatible ACME library, such as Greenlock.js or ACME.js.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Greenlock.js
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								var Greenlock = require('greenlock-express');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								var greenlock = Greenlock.create({
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									challenges: {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										'dns-01': dns01
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
										// ...
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								});
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								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.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## ACME.js
  
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:40:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:40:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								// TODO
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								See the [ACME.js ](https://git.rootprojects.org/root/acme-v2.js ) for more details.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Build your own
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								There are only 5 methods:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								-    `init(config)`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    `zones(opts)`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    `set(opts)`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    `get(opts)`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    `remove(opts)`  
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								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');
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									});
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								See acme-dns-01-test for more implementation details.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Tests
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```bash
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# node ./test.js domain-zone api-token
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								node ./test.js example.com xxxxxx
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Authors
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    Jarom Bridges 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								-    AJ ONeal 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								See AUTHORS for contact info.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Legal
  
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:31:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								[acme-dns-01-gandi.js ](https://git.coolaj86.com/coolaj86/acme-dns-01-gandi.js ) | MPL-2.0 | [Terms of Use ](https://therootcompany.com/legal/#terms ) | [Privacy Policy ](https://therootcompany.com/legal/#privacy )
							 
						 
					
						
							
								
									
										
										
										
											2019-07-12 02:12:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 22:20:52 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Copyright 2019 Jarom Bridges
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Copyright 2019 AJ ONeal
							 
						 
					
						
							
								
									
										
										
										
											2019-07-11 21:58:22 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Copyright 2019 The Root Group LLC