normalize names and conventions

This commit is contained in:
AJ ONeal 2016-08-09 13:05:36 -04:00
parent 6d1c594e17
commit 7fac8e5de6
2 changed files with 29 additions and 6 deletions

View File

@ -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 # le-challenge-fs
A fs-based strategy for node-letsencrypt for setting, retrieving, 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 Exposed Methods
--------------- ---------------
For ACME Challenge: For ACME Challenge:
* `setChallange(opts, domain, key, val, done)` * `set(opts, domain, key, val, done)`
* `getChallange(opts, domain, key, done)` * `get(defaults, domain, key, done)`
* `removeChallange(opts, domain, key, done)` * `remove(defaults, domain, key, done)`
For node-letsencrypt internals: For node-letsencrypt internals:

View File

@ -32,21 +32,32 @@ Challenge.create = function (options) {
return results; 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'); var mkdirp = require('mkdirp');
mkdirp(defaults.webrootPath, function (err) { mkdirp(args.webrootPath, function (err) {
if (err) { if (err) {
done(err); done(err);
return; 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); 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) { Challenge.get = function (defaults, domain, key, done) {
fs.readFile(path.join(defaults.webrootPath, key), 'utf8', done); fs.readFile(path.join(defaults.webrootPath, key), 'utf8', done);
}; };