| 
									
										
										
										
											2015-12-11 06:22:46 -08:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 18:50:55 -06:00
										 |  |  | var DAY = 24 * 60 * 60 * 1000; | 
					
						
							|  |  |  | //var MIN = 60 * 1000;
 | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  | var ACME = require('le-acme-core').ACME; | 
					
						
							| 
									
										
										
										
											2015-12-12 15:05:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-13 01:04:12 +00:00
										 |  |  | var LE = module.exports; | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  | LE.LE = LE; | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  | // in-process cache, shared between all instances
 | 
					
						
							|  |  |  | var ipc = {}; | 
					
						
							| 
									
										
										
										
											2016-08-04 18:49:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-12 21:33:50 -05:00
										 |  |  | LE.defaults = { | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  |   productionServerUrl: ACME.productionServerUrl | 
					
						
							|  |  |  | , stagingServerUrl: ACME.stagingServerUrl | 
					
						
							| 
									
										
										
										
											2016-08-04 18:49:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  | , rsaKeySize: ACME.rsaKeySize || 2048 | 
					
						
							|  |  |  | , challengeType: ACME.challengeType || 'http-01' | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  | , challengeTypes: ACME.challengeTypes || [ 'http-01', 'tls-sni-01', 'dns-01' ] | 
					
						
							| 
									
										
										
										
											2016-08-05 18:21:10 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  | , acmeChallengePrefix: ACME.acmeChallengePrefix | 
					
						
							| 
									
										
										
										
											2016-02-12 21:33:50 -05:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-12-20 02:41:17 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-16 01:11:31 -08:00
										 |  |  | // backwards compat
 | 
					
						
							| 
									
										
										
										
											2016-08-04 18:49:35 -04:00
										 |  |  | Object.keys(LE.defaults).forEach(function (key) { | 
					
						
							|  |  |  |   LE[key] = LE.defaults[key]; | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-12-13 01:04:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:21:10 -04:00
										 |  |  | // show all possible options
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | var u; // undefined
 | 
					
						
							|  |  |  | LE._undefined = { | 
					
						
							| 
									
										
										
										
											2016-08-08 11:21:33 -04:00
										 |  |  |   acme: u | 
					
						
							|  |  |  | , store: u | 
					
						
							| 
									
										
										
										
											2016-08-09 14:05:47 -04:00
										 |  |  | , challenge: u | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  | , challenges: u | 
					
						
							|  |  |  | , sni: u | 
					
						
							|  |  |  | , httpsOptions: u | 
					
						
							| 
									
										
										
										
											2016-08-08 19:14:53 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | , register: u | 
					
						
							|  |  |  | , check: u | 
					
						
							| 
									
										
										
										
											2016-08-08 19:14:53 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 18:50:55 -06:00
										 |  |  | , renewWithin: u // le-auto-sni and core
 | 
					
						
							|  |  |  | //, renewBy: u // le-auto-sni
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | , memorizeFor: u | 
					
						
							|  |  |  | , acmeChallengePrefix: u | 
					
						
							| 
									
										
										
										
											2016-08-05 18:21:10 -04:00
										 |  |  | , rsaKeySize: u | 
					
						
							|  |  |  | , challengeType: u | 
					
						
							|  |  |  | , server: u | 
					
						
							| 
									
										
										
										
											2016-08-06 01:33:19 -04:00
										 |  |  | , agreeToTerms: u | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  | , _ipc: u | 
					
						
							| 
									
										
										
										
											2016-08-09 14:05:47 -04:00
										 |  |  | , duplicate: u | 
					
						
							|  |  |  | , _acmeUrls: u | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | LE._undefine = function (le) { | 
					
						
							|  |  |  |   Object.keys(LE._undefined).forEach(function (key) { | 
					
						
							|  |  |  |     if (!(key in le)) { | 
					
						
							|  |  |  |       le[key] = u; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return le; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | LE.create = function (le) { | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   var PromiseA = require('bluebird'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-08 15:17:09 -04:00
										 |  |  |   le.acme = le.acme || ACME.create({ debug: le.debug }); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   le.store = le.store || require('le-store-certbot').create({ debug: le.debug }); | 
					
						
							|  |  |  |   le.core = require('./lib/core'); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |   if (!le.challenges) { | 
					
						
							|  |  |  |     le.challenges = {}; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!le.challenges['http-01']) { | 
					
						
							|  |  |  |     le.challenges['http-01'] = require('le-challenge-fs').create({ debug: le.debug }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!le.challenges['tls-sni-01']) { | 
					
						
							|  |  |  |     le.challenges['tls-sni-01'] = le.challenges['http-01']; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!le.challenges['dns-01']) { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       le.challenges['dns-01'] = require('le-challenge-ddns').create({ debug: le.debug }); | 
					
						
							|  |  |  |     } catch(e) { | 
					
						
							|  |  |  |       try { | 
					
						
							|  |  |  |         le.challenges['dns-01'] = require('le-challenge-dns').create({ debug: le.debug }); | 
					
						
							|  |  |  |       } catch(e) { | 
					
						
							|  |  |  |         // not yet implemented
 | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   le = LE._undefine(le); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   le.acmeChallengePrefix = LE.acmeChallengePrefix; | 
					
						
							| 
									
										
										
										
											2016-08-05 18:21:10 -04:00
										 |  |  |   le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize; | 
					
						
							|  |  |  |   le.challengeType = le.challengeType || LE.challengeType; | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   le._ipc = ipc; | 
					
						
							| 
									
										
										
										
											2016-08-08 19:14:53 -04:00
										 |  |  |   le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) { | 
					
						
							|  |  |  |     agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register")); | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 18:50:55 -06:00
										 |  |  |   if (!le.renewWithin) { le.renewWithin = 7 * DAY; } | 
					
						
							|  |  |  |   // renewBy has a default in le-sni-auto
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   if (!le.memorizeFor) { le.memorizeFor = 1 * 24 * 60 * 60 * 1000; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!le.server) { | 
					
						
							|  |  |  |     throw new Error("opts.server must be set to 'staging' or a production url, such as LE.productionServerUrl'"); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if ('staging' === le.server) { | 
					
						
							|  |  |  |     le.server = LE.stagingServerUrl; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if ('production' === le.server) { | 
					
						
							|  |  |  |     le.server = LE.productionServerUrl; | 
					
						
							| 
									
										
										
										
											2015-12-13 05:03:48 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-12-17 08:46:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-08 11:21:33 -04:00
										 |  |  |   if (le.acme.create) { | 
					
						
							|  |  |  |     le.acme = le.acme.create(le); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   le.acme = PromiseA.promisifyAll(le.acme); | 
					
						
							|  |  |  |   le._acmeOpts = le.acme.getOptions(); | 
					
						
							|  |  |  |   Object.keys(le._acmeOpts).forEach(function (key) { | 
					
						
							|  |  |  |     if (!(key in le)) { | 
					
						
							|  |  |  |       le[key] = le._acmeOpts[key]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   if (le.store.create) { | 
					
						
							|  |  |  |     le.store = le.store.create(le); | 
					
						
							| 
									
										
										
										
											2015-12-15 15:40:44 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   le.store = PromiseA.promisifyAll(le.store); | 
					
						
							| 
									
										
										
										
											2016-08-13 13:54:07 -06:00
										 |  |  |   le.store.accounts = PromiseA.promisifyAll(le.store.accounts); | 
					
						
							|  |  |  |   le.store.certificates = PromiseA.promisifyAll(le.store.certificates); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   le._storeOpts = le.store.getOptions(); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   Object.keys(le._storeOpts).forEach(function (key) { | 
					
						
							| 
									
										
										
										
											2016-08-08 11:21:33 -04:00
										 |  |  |     if (!(key in le)) { | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |       le[key] = le._storeOpts[key]; | 
					
						
							| 
									
										
										
										
											2015-12-12 14:20:12 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |   LE.challengeTypes.forEach(function (challengeType) { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |     if (!le.challenges[challengeType]) { | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |     if (le.challenges[challengeType].create) { | 
					
						
							|  |  |  |       le.challenges[challengeType] = le.challenges[challengeType].create(le); | 
					
						
							| 
									
										
										
										
											2015-12-20 02:41:17 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |     le.challenges[challengeType] = PromiseA.promisifyAll(le.challenges[challengeType]); | 
					
						
							|  |  |  |     le['_challengeOpts_' + challengeType] = le.challenges[challengeType].getOptions(); | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |     Object.keys(le['_challengeOpts_' + challengeType]).forEach(function (key) { | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |       if (!(key in le)) { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |         le[key] = le['_challengeOpts_' + challengeType][key]; | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |       } | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2016-08-12 15:24:28 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |   //
 | 
					
						
							|  |  |  |   // Backwards compat until we fix le.challenges to be per-request
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   if (le.challenge) { | 
					
						
							|  |  |  |     console.warn("Deprecated use of le.challenge. Use le.challenges['" + LE.challengeType + "'] instead."); | 
					
						
							|  |  |  |     // TODO le.challenges[le.challengeType] = le.challenge
 | 
					
						
							|  |  |  |     if (le.challenge.create) { | 
					
						
							|  |  |  |       le.challenge = le.challenge.create(le); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |     le.challenge = le.challenges[le.challengeType]; | 
					
						
							| 
									
										
										
										
											2016-08-15 15:33:26 -06:00
										 |  |  |   } | 
					
						
							|  |  |  |   le._challengeOpts = le.challenge.getOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 14:36:58 -06:00
										 |  |  |   le.sni = le.sni || null; | 
					
						
							|  |  |  |   if (!le.httpsOptions) { | 
					
						
							|  |  |  |     le.httpsOptions = {}; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!le.httpsOptions.SNICallback) { | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |     if (!le.getCertificatesAsync && !le.getCertificates) { | 
					
						
							|  |  |  |       if (!le.approveDomains) { | 
					
						
							|  |  |  |         if (!(le.approvedDomains && le.email && le.agreeTos)) { | 
					
						
							|  |  |  |           throw new Error("You must provide opts.approveDomains(domain, certs, callback) to approve certificates"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         le.approveDomains = function (lexOpts, certs, cb) { | 
					
						
							|  |  |  |           if (lexOpts.domains.every(function (domain) { | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |             return -1 !== le.approvedDomains.indexOf(domain); | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |           })) { | 
					
						
							|  |  |  |             lexOpts.domains = le.approvedDomains.slice(0); | 
					
						
							|  |  |  |             lexOpts.email = le.email; | 
					
						
							|  |  |  |             lexOpts.agreeTos = le.agreeTos; | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |             return cb(null, { options: lexOpts, certs: certs }); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (le.debug) { | 
					
						
							|  |  |  |             console.log('unapproved domain', lexOpts.domains, le.approvedDomains); | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |           } | 
					
						
							|  |  |  |           cb(new Error("unapproved domain")); | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       le.getCertificates = function (domain, certs, cb) { | 
					
						
							| 
									
										
										
										
											2016-08-16 13:02:14 -04:00
										 |  |  |         // certs come from current in-memory cache, not lookup
 | 
					
						
							|  |  |  |         if (le.debug) { | 
					
						
							|  |  |  |           console.log('le.getCertificates called for', domain, 'with certs for', certs && certs.altnames || 'NONE'); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |         var opts = { domain: domain, domains: certs && certs.altnames || [ domain ] }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         le.approveDomains(opts, certs, function (_err, results) { | 
					
						
							| 
									
										
										
										
											2016-08-16 13:02:14 -04:00
										 |  |  |           if (le.debug) { | 
					
						
							|  |  |  |             console.log('le.approveDomains called with certs for', results.certs && results.certs.altnames || 'NONE', 'and options:'); | 
					
						
							|  |  |  |             console.log(results.options); | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |           if (_err) { | 
					
						
							|  |  |  |             cb(_err); | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           var promise; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (results.certs) { | 
					
						
							| 
									
										
										
										
											2016-08-16 13:02:14 -04:00
										 |  |  |             if (le.debug) { | 
					
						
							|  |  |  |               console.log('le renewing'); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |             promise = le.core.certificates.renewAsync(results.options, results.certs); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							| 
									
										
										
										
											2016-08-16 13:02:14 -04:00
										 |  |  |             if (le.debug) { | 
					
						
							|  |  |  |               console.log('le getting from disk or registering new'); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             promise = le.core.certificates.getAsync(results.options); | 
					
						
							| 
									
										
										
										
											2016-08-15 18:42:11 -06:00
										 |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           return promise.then(function (certs) { cb(null, certs); }, cb); | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-08-15 14:36:58 -06:00
										 |  |  |     le.sni = le.sni || require('le-sni-auto'); | 
					
						
							|  |  |  |     if (le.sni.create) { | 
					
						
							|  |  |  |       le.sni = le.sni.create(le); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     le.httpsOptions.SNICallback = le.sni.sniCallback; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (!le.httpsOptions.key || !le.httpsOptions.cert) { | 
					
						
							|  |  |  |     le.httpsOptions = require('localhost.daplie.com-certificates').merge(le.httpsOptions); | 
					
						
							| 
									
										
										
										
											2016-08-12 15:24:28 -06:00
										 |  |  |   } | 
					
						
							|  |  |  |   /* | 
					
						
							|  |  |  |   le.sni = PromiseA.promisifyAll(le.sni); | 
					
						
							|  |  |  |   le._sniOpts = le.sni.getOptions(); | 
					
						
							|  |  |  |   Object.keys(le._sniOpts).forEach(function (key) { | 
					
						
							|  |  |  |     if (!(key in le)) { | 
					
						
							|  |  |  |       le[key] = le._sniOpts[key]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-09 15:02:10 -04:00
										 |  |  |   // TODO wrap these here and now with tplCopy?
 | 
					
						
							|  |  |  |   if (5 !== le.challenge.set.length) { | 
					
						
							|  |  |  |     throw new Error("le.challenge.set receives the wrong number of arguments." | 
					
						
							|  |  |  |       + " You must define setChallenge as function (opts, domain, key, val, cb) { }"); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (4 !== le.challenge.get.length) { | 
					
						
							|  |  |  |     throw new Error("le.challenge.get receives the wrong number of arguments." | 
					
						
							|  |  |  |       + " You must define getChallenge as function (opts, domain, key, cb) { }"); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (4 !== le.challenge.remove.length) { | 
					
						
							|  |  |  |     throw new Error("le.challenge.remove receives the wrong number of arguments." | 
					
						
							|  |  |  |       + " You must define removeChallenge as function (opts, domain, key, cb) { }"); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:50:42 -04:00
										 |  |  |   if (le.core.create) { | 
					
						
							|  |  |  |     le.core = le.core.create(le); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-16 12:35:18 -04:00
										 |  |  |   le.renew = function (args, certs) { | 
					
						
							|  |  |  |     return le.core.certificates.renewAsync(args, certs); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   le.register = function (args) { | 
					
						
							| 
									
										
										
										
											2016-08-07 02:02:02 -04:00
										 |  |  |     return le.core.certificates.getAsync(args); | 
					
						
							| 
									
										
										
										
											2015-12-12 14:20:12 +00:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2015-12-11 06:22:46 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   le.check = function (args) { | 
					
						
							|  |  |  |     // TODO must return email, domains, tos, pems
 | 
					
						
							| 
									
										
										
										
											2016-08-07 02:02:02 -04:00
										 |  |  |     return le.core.certificates.checkAsync(args); | 
					
						
							| 
									
										
										
										
											2016-08-05 18:16:29 -04:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-09 14:05:47 -04:00
										 |  |  |   le.middleware = le.middleware || require('./lib/middleware'); | 
					
						
							|  |  |  |   if (le.middleware.create) { | 
					
						
							|  |  |  |     le.middleware = le.middleware.create(le); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-08-05 04:14:40 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-12 14:20:12 +00:00
										 |  |  |   return le; | 
					
						
							| 
									
										
										
										
											2015-12-11 06:22:46 -08:00
										 |  |  | }; |