From a654891cfae9c93238d72c8fc1859d1a1ae144d9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 5 Aug 2016 18:21:10 -0400 Subject: [PATCH] update --- README.md | 47 +++++++++++++++++++++++------------------------ index.js | 17 ++++++++++------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index cdc11d1..6ec547c 100644 --- a/README.md +++ b/README.md @@ -154,31 +154,30 @@ le.exists({ domain: 'example.com' }).then(function (results) { return; } + // Register Certificate manually - le.register( + le.register({ - { domains: ['example.com'] // CHANGE TO YOUR DOMAIN (list for SANS) - , email: 'user@email.com' // CHANGE TO YOUR EMAIL - , agreeTos: '' // set to tosUrl string to pre-approve (and skip agreeToTerms) - , rsaKeySize: 2048 // 1024 or 2048 - , challengeType: 'http-01' // http-01, tls-sni-01, or dns-01 - } + domains: ['example.com'] // CHANGE TO YOUR DOMAIN (list for SANS) + , email: 'user@email.com' // CHANGE TO YOUR EMAIL + , agreeTos: '' // set to tosUrl string to pre-approve (and skip agreeToTerms) + , rsaKeySize: 2048 // 2048 or higher + , challengeType: 'http-01' // http-01, tls-sni-01, or dns-01 - , function (err, results) { - if (err) { - // Note: you must either use le.middleware() with express, - // manually use le.getChallenge(domain, key, val, done) - // or have a webserver running and responding - // to /.well-known/acme-challenge at `webrootPath` - console.error('[Error]: node-letsencrypt/examples/standalone'); - console.error(err.stack); - return; - } + }).then(function (results) { - console.log('success'); - } + console.log('success'); - ); + }, function (err) { + + // Note: you must either use le.middleware() with express, + // manually use le.getChallenge(domain, key, val, done) + // or have a webserver running and responding + // to /.well-known/acme-challenge at `webrootPath` + console.error('[Error]: node-letsencrypt/examples/standalone'); + console.error(err.stack); + + }); }); ``` @@ -241,7 +240,7 @@ TODO double check and finish * accounts.get * accounts.exists * certs - * certs.byDomain + * certs.byAccount * certs.all * certs.get * certs.exists @@ -250,9 +249,9 @@ TODO double check and finish TODO finish -* setChallenge(opts, domain, key, value, done); // opts will be saved with domain/key -* getChallenge(domain, key, done); // opts will be retrieved by domain/key -* removeChallenge(domain, key, done); // opts will be retrieved by domain/key +* `.set(opts, domain, key, value, done);` // opts will be saved with domain/key +* `.get(opts, domain, key, done);` // opts will be retrieved by domain/key +* `.remove(opts, domain, key, done);` // opts will be retrieved by domain/key Change History ============== diff --git a/index.js b/index.js index b9bcfa6..0582be7 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,17 @@ 'use strict'; -// TODO handle www and no-www together somehow? - var PromiseA = require('bluebird'); var leCore = require('letiny-core'); var LE = module.exports; LE.defaults = { - server: leCore.productionServerUrl -, stagingServer: leCore.stagingServerUrl -, liveServer: leCore.productionServerUrl - -, productionServerUrl: leCore.productionServerUrl + productionServerUrl: leCore.productionServerUrl , stagingServerUrl: leCore.stagingServerUrl +, rsaKeySize: leCore.rsaKeySize || 2048 +, challengeType: leCore.challengeType || 'http-01' + , acmeChallengePrefix: leCore.acmeChallengePrefix }; @@ -23,6 +20,7 @@ Object.keys(LE.defaults).forEach(function (key) { LE[key] = LE.defaults[key]; }); +// show all possible options var u; // undefined LE._undefined = { store: u @@ -32,6 +30,9 @@ LE._undefined = { , renewWithin: u , memorizeFor: u , acmeChallengePrefix: u +, rsaKeySize: u +, challengeType: u +, server: u }; LE._undefine = function (le) { Object.keys(LE._undefined).forEach(function (key) { @@ -49,6 +50,8 @@ LE.create = function (le) { var core = le.core = require('./lib/core'); le.acmeChallengePrefix = LE.acmeChallengePrefix; + le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize; + le.challengeType = le.challengeType || LE.challengeType; if (!le.renewWithin) { le.renewWithin = 3 * 24 * 60 * 60 * 1000; } if (!le.memorizeFor) { le.memorizeFor = 1 * 24 * 60 * 60 * 1000; }