From 7fac8e5de656f77767183e838f8b158293a8c873 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 9 Aug 2016 13:05:36 -0400 Subject: [PATCH] normalize names and conventions --- README.md | 18 +++++++++++++++--- index.js | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 945c0f6..41cf6c1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +[![Join the chat at https://gitter.im/Daplie/letsencrypt-express](https://badges.gitter.im/Daplie/letsencrypt-express.svg)](https://gitter.im/Daplie/letsencrypt-express?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +| [letsencrypt](https://github.com/Daplie/node-letsencrypt) (library) +| [letsencrypt-cli](https://github.com/Daplie/letsencrypt-cli) +| [letsencrypt-express](https://github.com/Daplie/letsencrypt-express) +| [letsencrypt-koa](https://github.com/Daplie/letsencrypt-koa) +| [letsencrypt-hapi](https://github.com/Daplie/letsencrypt-hapi) +| + # le-challenge-fs A fs-based strategy for node-letsencrypt for setting, retrieving, @@ -33,14 +42,17 @@ LE.create({ }); ``` +NOTE: If you request a certificate with 6 domains listed, +it will require 6 individual challenges. + Exposed Methods --------------- For ACME Challenge: -* `setChallange(opts, domain, key, val, done)` -* `getChallange(opts, domain, key, done)` -* `removeChallange(opts, domain, key, done)` +* `set(opts, domain, key, val, done)` +* `get(defaults, domain, key, done)` +* `remove(defaults, domain, key, done)` For node-letsencrypt internals: diff --git a/index.js b/index.js index 144cef2..891ed22 100644 --- a/index.js +++ b/index.js @@ -32,21 +32,32 @@ Challenge.create = function (options) { return results; }; -Challenge.set = function (defaults, domain, challengePath, keyAuthorization, done) { +// +// NOTE: the "args" here in `set()` are NOT accessible to `get()` and `remove()` +// They are provided so that you can store them in an implementation-specific way +// if you need access to them. +// +Challenge.set = function (args, domain, challengePath, keyAuthorization, done) { var mkdirp = require('mkdirp'); - mkdirp(defaults.webrootPath, function (err) { + mkdirp(args.webrootPath, function (err) { if (err) { done(err); return; } - fs.writeFile(path.join(defaults.webrootPath, challengePath), keyAuthorization, 'utf8', function (err) { + fs.writeFile(path.join(args.webrootPath, challengePath), keyAuthorization, 'utf8', function (err) { done(err); }); }); }; + +// +// NOTE: the "defaults" here are still merged and templated, just like "args" would be, +// but if you specifically need "args" you must retrieve them from some storage mechanism +// based on domain and key +// Challenge.get = function (defaults, domain, key, done) { fs.readFile(path.join(defaults.webrootPath, key), 'utf8', done); };